I have some data file like this:
Id a1 a2 a3
1 1 2 3
2 2 3 4
3 2 3 4
But I don't know the exact number of column, but I can get it into variable with shell. And I want to plot the data file, the first column as the x-axis and the others as the y-axis in one picture and the column header as the title for line.like this:
How to plot in gnuplot? Many thanks
Consider this example
colhead.gp:
plot for [i=2:n+1] 'colhead.dat' u 1:i w lp title columnheader(i)
colhead.dat:
Id a1 a2 a3
1 1 2 3
2 2 3 4
3 2 3 4
To get parameter from the shell:
gnuplot -persist -e "n=4" colhead.gp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With