문제

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?

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top