curves - gnuplot: plotting a file with 4 columns all on y-axis -
i have file contains 4 numbers (min, max, mean, standard derivation) , plot gnuplot.
sample:
24 31 29.0909 2.57451 12 31 27.2727 5.24129 14 31 26.1818 5.04197 22 31 27.7273 3.13603 22 31 28.1818 2.88627
if have 4 files 1 column, can do:
gnuplot "file1.txt" lines, "file2.txt" lines, "file3.txt" lines, "file4.txt" lines
and plot 4 curves. not care x-axis, should constant increment.
how please plot? can't seem find way have 4 curves 1 file 4 columns, having incrementing x value.
thank you.
you can plot different columns of same file this:
plot 'file' using 0:1 lines, '' using 0:2 lines ...
(...
means continuation). couple of notes on notation: using
specifies column plot i.e. column 0 , 1 in first using
statement, 0th column pseudo column translates current line number in data file. note if 1 argument used using
(e.g. using n
) corresponds saying using 0:n
(thanks pointing out mgilson).
if gnuplot version recent enough, able plot 4 columns for-loop:
set key outside plot [col=1:4] 'file' using 0:col lines
result:
gnuplot can use column headings title if in data file, e.g.:
min max mean std 24 31 29.0909 2.57451 12 31 27.2727 5.24129 14 31 26.1818 5.04197 22 31 27.7273 3.13603 22 31 28.1818 2.88627
and
set key outside plot [col=1:4] 'file' using 0:col lines title columnheader
results in:
Comments
Post a Comment