Histograms that include empty bins

Dima Kogan <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.devel
Message-ID <[email protected]>
Hi. I just tried to patch gnuplot to do something that I thought would
be simple, but it actually looks like it wouldn't be. Can I get a
suggestion?

I'm making a simple histogram. This works as expected:

set boxwidth 1
histbin(x) = floor(0.5 + x)
plot '-' using (histbin($1)):(1.0) smooth freq with boxes fill solid border lt -1 
1
2
4
5
e

Here I get 4 bins of width 1, centered at 1, 2, 4, 5. Notably, there's a
gap: there's no bin centered at 3. Internally, gnuplot omits this bin
entirely, instead of producing an empty bin. This matters if you make a
this plot "with linespoints" instead of "with boxes". I want a plot that
includes the point (3,0), but the current code doesn't include that
point. Is there an obvious way to include that?

Thanks!


_______________________________________________
gnuplot-beta mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.