gnuplot:将columnheader设置为标签 [英] gnuplot: set columnheader as label

查看:123
本文介绍了gnuplot:将columnheader设置为标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将数据文件列的标题设置为标签(而不是键)?

Is there a chance to set the header of the data file columns as label (not as key)?

我有5或6列的数据文件,每列上方都有一个标题.现在,我想在set label命令中使用columnheader.这可能吗?

I have data files with 5 or 6 columns and a header above each column. Now I would like to use the columnheader with the set label command. Is this possible?

推荐答案

unixoid系统上

On a unixoid system, the head command helps:

header = system("head -n 1 ".filename)
label1 = word(header,1)
label2 = word(header,2)
...
set label 1 at 0.5,0.5 label1
set label 2 ....

MS win 没有head命令,您可以使用相反,如果标题行以#"开头.或使用 cygwin 在Windows下获得完整的GNU + POSIX环境.

MS win does not have the head command, you might use 'findstr /B \"#\"' instead, if the header line begins with a "#". Or use cygwin to get a full GNU + POSIX environment under Windows.

word()函数应在与columnhead()相同的位置拆分标题字符串.当然,除非您使用其他分隔符(不是空格或制表符):

The word() function should split your header string at the same positions as columnhead(). Unless of course you have a different separator (not space or tab):

separator =","
p1 = strstrt(header,separator)
p2 = strstrt(header[p1+1:],separator)
...
label1=header[1:p1-1]
...

这篇关于gnuplot:将columnheader设置为标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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