我有以下数据:
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直方图:如何在条形图上放置值
发布评论