gnuplot指定标签列 [英] gnuplot specify column for label

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

问题描述

我正在gnuplot中进行多重绘图.我想从某些列中选择点的标签.例如,假设数据文件为:

I am doing a multiplot in gnuplot. I want to pick the labels for the points from certain columns. For example, say the data file is:

 year temp label1 year humidity label2
 1990 30   hot    1991 100      wet
 1992 25   warm   1992 83       dry

我想使用第3列(标签1)作为点的标签绘制第2列(温度)与第1列(年份)的关系,并在同一图形上使用第6列绘制第5列(湿度)与第4列(年份)的关系( label2)作为标签.这可能吗?

I want to plot column 2 (temp) versus column 1 (year) using column 3 (label1) as label for the points and on the same graph plot column 5 (humidity) versus column 4 (year) using column 6 (label2) as label. Is this possible?

  plot 'weather.dat' using 1:2 with points with labels, '' using 4:5 with points with labels

推荐答案

使用标签样式.这种样式期望与标签列一起接收x和y坐标.

Use the labels style. This style expects to receive the x and y coordinates along with the label column.

对于您的数据以及图表的第一部分,我们可以做

For your data, and the first part of the plot, we can do

plot 'weather.data' using 1:2 with points, '' using 1:2:3 with labels

如果我们希望增加一些间距,可以调整标签y坐标.例如,使用

If we wish to add a little spacing, we can adjust the label y coordinate. For example, moving it up by 1 unit with

plot 'weather.data' using 1:2 with points, '' using 1:($2+1):3 with labels

对于此图,为了确保所有内容都完全适合内部,我手动将xrange设置为[1989:1993],将yrange设置为[20:35].

For this plot, in order to make sure that everything fit completely inside, I manually set the xrange to [1989:1993] and the yrange to [20:35].

一种类似的方法也可以与其他数据列配合使用,当然可以将其与常规数据结合使用(尽管y范围相差很大,可能应该在其自己的图上或使用辅助轴完成)

A similar approach works with your other columns of data, which can, of course, be combined with this as normal (although with the massively different y range, probably should be done on it's own plot, or using a secondary axis).

有关更多信息,请参见help labels.

See help labels for more information.

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

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