I'm trying to get a histogram plot for data that has been collected in buckets that are portions of [0,1]. That is, I collect counts of values that fall into [0, 0.05), [0.05, 0.1), [0.1, 0.15), etc. The data is collected in an list, where each element of the list contains counts for each bucket so far.
I don't use the
histogram function; I don't see how to use that in a convenient way with data collected in a list, from many ticks. Instead, I've been doing this:
let x 0 foreach normalized-buckets [ plotxy x ? ;set x x + bucket-size set x x + 1 ]
There are no plotting commands in the pen box in the UI. I've listed two versions of the line that increments the x coordinate.
(1) What I would prefer to use is the line that's commented out. I would like the plot to display 1 as the max value in the plot's lower right corner, with a narrow bars as in a normal histogram. Instead, what I get are overlapping bars that start at the x coordinate
x, and end at 1.
If you have advice about how to do this, there may be no need to read the rest of my question.
(2) The only way I've found to get a normal histogram effect is to plot at integer values, i.e. using the second
set x line. This has two problems, but it may be the best solution.
First, using this method, the plot displays a max value other than 1 in the lower right corner, when it works, since I'm plotting values at integers 1-20 rather than at 0, 0.05, etc.
Second, I can't figure out how to get the plot to use 20 as the max value, or even 21. The problem is that no matter what I do, I can get 20 histogram bars only if I choose
auto-scale on for the plot. For buckets of size 0.05, i.e. 20 buckets, the result is that the max value displayed on the lower left corner of the plot is then 22.5, and there's a space to the right of the bars. This looks crude, though it works.
I've tried using
set-plot-x-range in various ways without
auto-scale, both in the plot setup commands window, and in my
setup routine. No matter what I do, once the plotting begins, the max value reverts to 1. (This happens with either of the
set x lines above. With
set x x + 1, only a line at y=0 is displayed--presumably because I have no data in the first bucket most of the time.)
So I can get a workable histogram, but only with a max value displayed as 22.5, and with a space to the right of the bars.