向gnuplot自动标题中添加字符串

4
我正在使用 gnuplot 的脚本命令 set key autotitle columnhead 来为我的数据添加标签。唯一的问题是,列标题的数据是数字,所以它本身并没有太多意义。
是否有办法在自动标题中添加固定字符串,例如 "年份" + columnhead,或者给我的键添加一个标题?
1个回答

2

在gnuplot v4.6中,使用columnhead().操作符进行字符串连接(文档):

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输出

是的,您可以为键设置标题,如下所示:set key title '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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接