将字符串添加到gnuplot自动标题中

我正在使用gnuplot scrip命令set key autotitle columnhead为我的数据制作标签.唯一的问题是,列头数据是数字的,因此它本身并不是真正意义上的.

有没有办法在自动标题中添加固定字符串,例如“年”栏目,或者为我的密钥添加标题?

最佳答案 使用字符串连接.具有columnhead()的运算符在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)

《将字符串添加到gnuplot自动标题中》

此外,是的,您可以为键设置标题,如下所示:设置键标题’f(x)’.

输入文件data.txt在此示例中使用:

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
点赞