Domanda

I am trying to set the title of my gnuplot chart from the last line in my .dat file but I am not sure what to do.

My .dat file reads like:

Column1 Column2
1 0.5
2 1.5
3 2.5
4 3.5
5 4.5
6 5.5   
Average is ??????

Would anyone know the command to set the title using the text of the last line?

È stato utile?

Soluzione

gnuplot allows for shell-style backtick expansion. Combining that with the unix utility tail should work just fine:

set title "`tail -1 myfile.dat`"
plot 'myfile.dat' u 1:2
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top