向gnuplot自动标题添加字符串 [英] Adding a string to a gnuplot autotitle

查看:122
本文介绍了向gnuplot自动标题添加字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

是否可以在自动标题中添加固定的字符串(例如"Year " + columnhead),或者给我的密钥赋予标题?

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

推荐答案

使用.运算符和columnhead()进行字符串连接在gnuplot v4.6中有效(

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)

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

Also, yes, you can set a title for the key instead, like this: set key title 'f(x)'.

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

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

这篇关于向gnuplot自动标题添加字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆