gnuplot直方图:如何在条形图上放置值

编程入门 行业动态 更新时间:2024-10-06 20:34:09
本文介绍了gnuplot直方图:如何在条形图上放置值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下数据:

1 3215 2 321 ... 31_60 59 60+ 32

我想使用gnuplot生成直方图,并将bar的值放在其顶部.

I would like to generate histogram using gnuplot and put the value of bar on top of it.

这是我尝试创建直方图的gnuplot命令:

Here is the gnuplot command I tried to create histogram:

set style data histogram set xtics rotate plot 'file.dat' using 2:xtic(1)

有人可以告诉我如何在生成的条形图的顶部添加值吗?

Can someone tell me how to add values on top of the bars generated?

我发现了以下与链接相关的直方图( gnuplot-tricks.blogspot/2009/10/more-on-histograms.html ),但没有确切了解其作用.

I found the following link related histogram (gnuplot-tricks.blogspot/2009/10/more-on-histograms.html), but didnt get what its doing exactly.

推荐答案

以此为示例数据文件 Data.dat :

1 10 2 20 3 15 4 16 5 19 6 5

您可以运行以下脚本来显示框及其上方的框的相应值:

You could run this script to display boxes and the corresponding value of that box above it:

set key off plot 'Data.dat' with boxes fill pattern 1, '' u 1:($2 + 0.5):($2) with labels

注意 u 1:($ 2 + 0.5):($ 2),其中 0.5 指定框上方的值.

Notice the u 1:($2 + 0.5):($2) where the 0.5 specifies how much the value is above the box.

更多推荐

gnuplot直方图:如何在条形图上放置值

本文发布于:2023-07-18 08:14:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1142735.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:直方图   条形   图上   如何在   gnuplot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!