I am using the gnuplot scrip command set key autotitle columnhead
to make the lables for my data. The only issue is, the column head data is numeric and so it d
String concatenation using .
operator with columnhead()
works in gnuplot v4.6 (documentation):
set terminal pngcairo enhanced truecolor size 480,320 fontscale 0.8
set output 'autotitle.png'
set key left Left
plot for [i=2:4] 'data.txt' u 1:i w l t 'f(x) = '.columnhead(i)
Also, yes, you can set a title for the key instead, like this: set key title 'f(x)'
.
Input file data.txt
used in this example:
x 100x x^3 2^x
1 100 1 2
2 200 8 4
3 300 27 8
4 400 64 16
5 500 125 32
6 600 216 64
7 700 343 128
8 800 512 256
9 900 729 512
10 1000 1000 1024