1

我正在尝试在 Gnuplot 中创建 12 个月内每月事件的简单直方图。bin 2 或 bin 7 中都没有事件,并且不是将这些 bin 绘制为 0,而是将相邻的 bin 扩展到该空间上。我正在使用以下直方图绘图例程,我从这里得到:http: //gnuplot-surprising.blogspot.com.au/2011/09/statistic-analysis-and-histogram.html

max=12
min=1
binwidth=1
hist(x,width)=x
set style fill solid 0.5
set xrange[0.5:12.5]
plot "file" using (hist($4,binwidth)):(1.0) smooth freq w boxes lc rgb"green"

“文件”中的示例行如下所示:

2008-11-21-08:10:47 29455.0 2008 11 21 19:10:47

第四列是我要绘制的月份信息。生成的直方图位于链接中:

https://docs.google.com/drawings/d/12yFs_KIznhrMx62OIwJJFVmlnwIk4TXdHSdGc0yWqwI/edit?usp=sharing

以 2 和 7(应该为 0)为中心的 bin 丢失,而相邻的 bin 被扩展。我不确定我的错误在哪里,希望有任何帮助!谢谢!

4

1 回答 1

2

您应该查阅有关绘图样式的gnuplot文档。boxes利用

set boxwidth 1

否则会自动计算每个框的宽度,使其接触相邻的框。

于 2013-07-31T10:05:11.960 回答