Hi,
Let's consider a data file like this:
Col1 Col2 Col3 0 1 2 1 2 3 ...
How can I use in gnuplot script the name of the columns ("Col1", "Col2", "Col3") to label my axes or to define the title ?
Thanks
I generally preprocess the files with gawk or similar.
In your case I'd make something like this
gawk '{if (NR==1) print "set title \"$0\"; else {print "plot \"myfile.dat\" u 1:2 w etcetc "}}' myfile.dat > plot.gpi
so that plot.gpi contains
set title "Col1 Col2 Col3" plot "myfile.dat" u 1:2 w etcetc
then I'd issue
gnuplot plot.gpi
Edo
To set the plot titles:
set key autotitle columnhead
It's not clear how the column head values relate to axis labels. What value would appear where?
this method (set key autotitle columnhead) gives a partial answer... How can I do the same for the xlabel (or the title...) ?
Log in to post a comment.
Hi,
Let's consider a data file like this:
Col1 Col2 Col3
0 1 2
1 2 3
...
How can I use in gnuplot script the name of the columns ("Col1", "Col2", "Col3") to label my axes or to define the title ?
Thanks
I generally preprocess the files with gawk or similar.
In your case I'd make something like this
gawk '{if (NR==1) print "set title \"$0\"; else {print "plot \"myfile.dat\" u 1:2 w etcetc "}}' myfile.dat > plot.gpi
so that plot.gpi contains
set title "Col1 Col2 Col3"
plot "myfile.dat" u 1:2 w etcetc
then I'd issue
gnuplot plot.gpi
Edo
To set the plot titles:
set key autotitle columnhead
It's not clear how the column head values relate to axis labels. What value would appear where?
this method (set key autotitle columnhead) gives a partial answer...
How can I do the same for the xlabel (or the title...) ?
Thanks