====== Gnuplot ====== * [[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]] * http://gnuplot.sourceforge.net/demo_5.5/ * https://gnuplotting.org/ Exemple de code: set datafile separator ',' # set key autotitle columnhead # use the first line as title set title "title" noenhanced # noenhanced permet de ne pas traiter le titre comme du LaTeX set ylabel "Duration (s)" set xlabel "Number of workers" # set key center top set terminal pngcairo size 800,600 enhanced font 'Segoe UI,10' set output 'mpi-pipelined-all.png' # set y2tics # enable second axis # set ytics nomirror # dont show the tics on that side # set y2label "Number of iterations per second" # label for second axis set grid set xrange [3:] plot \ "1-mpi/result.csv" using 1:2 title "1 node" with linespoints, \ "2-mpi/result.csv" using 1:2 title "2 nodes (nb workers x 2)" with linespoints, \ "1-mpi/result.csv" using 1:($2/2) title "2 nodes with perfect scalability" with linespoints dashtype "--" 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]]). Pour lier les points par une ligne: set style data linespoints Paramètres de chaque courbe: * ''lc'' suivi d'un numéro ou du nom d'une couleur: couleur de la courbe * ''lt'' suivi d'un numéro: type de point * ''dt'' suivi d'un numéro: style de la ligne === Utilisation de scripts === Depuis un script Bash : gnuplot < Mettre toutes les commandes Gnuplot dans un fichier, puis : gnuplot script.gnuplot === Lire les données depuis l'entrée standard === cat fichier | gnuplot -p -e "plot '< cat -' using 1:xtic(2) notitle;" === Échelle logarithmique === [[http://gnuplot.sourceforge.net/docs_4.2/node197.html]] set logscale xz # active l'échelle log sur les axes x et z set logscale y 2 # active l'échelle log en base 2 sur l'axe y === Dessiner tous les fichiers d'un dossier === [[https://stackoverflow.com/questions/29969393/plot-all-files-in-a-directory-simultanously-with-gnuplot]] plot for [ f in system("ls *.csv") ] f using 1:2 title f === Changer la taille des labels d'un axe === [[https://stackoverflow.com/questions/15732856/set-font-size-of-values-numbers-on-the-axis|Source]] set xtics font ", 8" === Ne pas afficher la légende === [[https://stackoverflow.com/questions/8618487/gnuplot-removing-line-title|Source]] plot 'File.dat' using 1:2 notitle === 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]]) : set format x '%.f' ==== Statistiques ==== * [[http://gnuplot.sourceforge.net/demo_5.5/stats.html]] * [[https://entorb.net/wickie/Gnuplot#Stats]] stats "result.csv" using 4 prefix "A" stats "result.csv" using 5 prefix "B" set yrange [0:1.1] plot "result.csv" using 1:($4/A_max) title columnhead(4) with linespoints, "" using 1:($5/B_max) title columnhead(5) with linespoints ==== 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: 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 ... 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" === Histogramme empilé === set style histogram rowstacked plot "results.txt" using 2:xtic(1) title "Forward step", '' using 3 title "Backward step"