Appendix A: Plotting “.csv” files with gnuplot¶
Before running gnuplot:
The title lines at the top of the .csv files generated by analyse_hist are not understood by gnuplot. To make it ignore them we can set the first character of the title line as comment.
To see the top of the file use the Linux “head” command. For example:
head o_1_ho2_500K.csv
Should give something like:
distance,num
0.526389,0.000000e+00 0.579167,0.000000e+00 0.631944,0.000000e+00 0.684722,0.000000e+00 0.737500,0.000000e+00
So make a note that the letter “d” is the first letter on the title line.
Running gnuplot:
Open gnuplot from the command line by just typing the program name.
Now force the headings line to be ignored by typing:
set datafile commentschars “d”
For gnuplot to read comma delimited format files iwe also need to make the setting:
set datafile separator “,”
You can now plot the data from the file by typing:
plot “o_1_ho2_500K.csv”
You can over plot two or more sets of data by separating the file names with commas:
plot “o_1_ho2_150K.csv” , “o_1_ho2_500K.csv”