gnuplot

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
gnuplot [2021/05/02 13:44] – add log scales phswgnuplot [2025/06/16 13:06] (Version actuelle) – add link to gnuplotting phsw
Ligne 3: Ligne 3:
   * [[https://raymii.org/s/tutorials/GNUplot_tips_for_nice_looking_charts_from_a_CSV_file.html]]   * [[https://raymii.org/s/tutorials/GNUplot_tips_for_nice_looking_charts_from_a_CSV_file.html]]
   * [[https://www.cs.hmc.edu/~vrable/gnuplot/using-gnuplot.html]]   * [[https://www.cs.hmc.edu/~vrable/gnuplot/using-gnuplot.html]]
-  * [[http://gnuplot.sourceforge.net/demo_5.5/]]+  * http://gnuplot.sourceforge.net/demo_5.5/ 
 +  * https://gnuplotting.org/
  
  
Ligne 10: Ligne 11:
 set datafile separator ',' set datafile separator ','
 # set key autotitle columnhead # use the first line as title # set key autotitle columnhead # use the first line as title
-set title "title" noenhanced+set title "title" noenhanced # noenhanced permet de ne pas traiter le titre comme du LaTeX
 set ylabel "Duration (s)" set ylabel "Duration (s)"
 set xlabel "Number of workers" set xlabel "Number of workers"
Ligne 30: Ligne 31:
     "1-mpi/result.csv" using 1:($2/2) title "2 nodes with perfect scalability" with linespoints dashtype "--"     "1-mpi/result.csv" using 1:($2/2) title "2 nodes with perfect scalability" with linespoints dashtype "--"
 </code> </code>
 +
 +La colonne correspondant aux numéros de ligne dans le fichier est la colonne ''0'' ([[https://stackoverflow.com/questions/21452538/gnuplot-setting-x-axis-value-as-lines-from-text|source]]).
  
  
Ligne 43: Ligne 46:
  
  
-Utilisation depuis un script bash:+=== Utilisation de scripts === 
 + 
 +Depuis un script Bash :
 <code bash> <code bash>
 gnuplot <<EOF gnuplot <<EOF
 set terminal pngcairo size 800,600 enhanced font 'Segoe UI,10' set terminal pngcairo size 800,600 enhanced font 'Segoe UI,10'
 EOF EOF
 +</code>
 +
 +Mettre toutes les commandes Gnuplot dans un fichier, puis :
 +<code bash>
 +gnuplot script.gnuplot
 +</code>
 +
 +
 +=== Lire les données depuis l'entrée standard ===
 +
 +<code bash>
 +cat fichier | gnuplot -p -e "plot '< cat -' using 1:xtic(2) notitle;"
 </code> </code>
  
Ligne 61: Ligne 78:
  
  
 +=== Dessiner tous les fichiers d'un dossier ===
 +
 +[[https://stackoverflow.com/questions/29969393/plot-all-files-in-a-directory-simultanously-with-gnuplot]]
 +
 +<code gnuplot>
 +plot for [ f in system("ls *.csv") ] f using 1:2 title f
 +</code>
 +
 +
 +=== Changer la taille des labels d'un axe ===
 +
 +[[https://stackoverflow.com/questions/15732856/set-font-size-of-values-numbers-on-the-axis|Source]]
 +
 +<code gnuplot>
 +set xtics font ", 8"
 +</code>
 +
 +
 +=== Ne pas afficher la légende ===
 +
 +[[https://stackoverflow.com/questions/8618487/gnuplot-removing-line-title|Source]]
 +
 +<code gnuplot>
 +plot 'File.dat' using 1:2 notitle
 +</code>
 +
 +
 +=== Changer le formatage des valeurs d'un axe ===
 +
 +Par exemple pour ne pas utiliser la notation scientifique sur l'axe des abscisses ([[https://stackoverflow.com/questions/33241104/turn-off-scientific-notation-in-gnuplot|source]]) :
 +<code gnuplot>
 +set format x '%.f'
 +</code>
  
 ==== Statistiques ==== ==== Statistiques ====
Ligne 74: Ligne 124:
 plot "result.csv" using 1:($4/A_max) title columnhead(4) with linespoints, "" using 1:($5/B_max) title columnhead(5) with linespoints plot "result.csv" using 1:($4/A_max) title columnhead(4) with linespoints, "" using 1:($5/B_max) title columnhead(5) with linespoints
 </code> </code>
 +
 +
 +
 +==== Histogramme ====
 +
 +  * [[http://gnuplot.sourceforge.net/demo/histograms.html]]
 +  * [[https://www.xmodulo.com/plot-bar-graph-gnuplot.html]]
 +  * [[https://noidea.dog/blog/graphing-chips-with-gnuplot]]
 +  * [[https://www.javaer101.com/en/article/16074902.html]]
 +  * [[https://stackoverflow.com/questions/18332161/gnuplot-histogram-cluster-bar-chart-with-one-line-per-category]]
 +
 +
 +Pour un fichier de ce style:
 +<code>
 +Thread #0        150.0   150.9   152.4
 +Thread #1        148.4   150.2   151.7
 +Thread #2        149.8   151.1   152.4
 +Thread #3        148.2   149.8   151.2
 +Thread #4        150.2   151.2   152.2
 +...
 +</code>
 +
 +<code gnuplot>
 +set terminal pngcairo size 800,600 enhanced font 'Segoe UI,10'
 +set output 'without-comm.png'
 +
 +set datafile separator '\t'
 +
 +set style histogram errorbars lw 1 # pour afficher les barres d'erreurs
 +set style data histogram
 +set style fill solid border -1
 +set ylabel "Duration (ms)"
 +set xtics rotate
 +
 +set xrange [-0.5:]
 +set yrange[0:140]
 +
 +# 3: valeur de la barre
 +# 2: minimum pour la barre d'erreur
 +# 4: maximum pour la barre d'erreur
 +# xtic(1): la première colonne sera pour les labels de x
 +plot "data-without-comm.out" using 3:2:4:xtic(1) title "Without communications"
 +</code>
 +
 +
 +=== Histogramme empilé ===
 +
 +<code gnuplot>
 +set style histogram rowstacked
 +plot "results.txt" using 2:xtic(1) title "Forward step", '' using 3 title "Backward step"
 +</code>
 +
  • gnuplot.1619955851.txt.gz
  • Dernière modification : 2021/05/02 13:44
  • de phsw