gnuplot中的条形图上的Y值? [英] Y-value on bar graph in gnuplot?

查看:119
本文介绍了gnuplot中的条形图上的Y值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以让gnuplot在其栏上显示数据点的精确y值或高度(使用带框"绘制)吗?我希望该图易于阅读,因此没有人必须将y轴与条形图的顶部对齐并猜测值是什么.

Can I get gnuplot to display the exact y-value or height of a data point (plotted using "with boxes") over its bar? I would like the plot to be easy to read so nobody has to line up the top of a bar with the y-axis and guess what the value is.

推荐答案

您可以使用标签样式,并将其与框样式组合到plot命令中.标签样式需要3列数据-x坐标,y坐标和实际标签文本.

You can use the labels style and combine it into the plot command with the boxes style. The labels style expects 3 columns of data - the x coordinate, the y coordinate, and the actual label text.

例如,带有以下数据

1 4
2 6
3 2
4 8

命令(我们将yrange设置为0-10,boxwidth设置为0.9,并设置实心填充样式)

the command (we set the yrange to 0 - 10 and boxwidth to 0.9 and set a solid fill style)

plot datafile u 1:2 with boxes, "" u 1:2:2 with labels offset char 0,1

产生

通常,标签将位于指定点(框的顶部边缘)的中心.通过指定偏移量,我们可以将它们向上移动到框的正上方.在这里,我们在x方向上没有使用偏移,但是在y方向上使用了1的单位.我们使用了字符坐标系,因此相当于向上移动一个字符单位.

Normally, the labels would be centered on the specified point (the top edge of the box). By specifying an offset, we can move them up to just above the box. Here we used no offset in the x direction, but a unit of 1 in the y direction. We used the character coordinate system, so this corresponds to moving up by one character unit.

这篇关于gnuplot中的条形图上的Y值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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