Adding a string to a gnuplot autotitle

爱⌒轻易说出口 提交于 2019-12-20 01:10:24

问题


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 doesnt really mean much on its own.

Is there a way to add a fixed string to the autotitle, eg "Year " + columnhead, or alternatively, give my key a title?


回答1:


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


来源:https://stackoverflow.com/questions/34250235/adding-a-string-to-a-gnuplot-autotitle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!