pyplot.hist()
documentation specifies that when setting a range for a histogram "lower and upper outliers are ignored".
Is it possible to make the first and last bins of a histogram include all outliers without changing the width of the bin?
For example, let's say I want to look at the range 0-3
with 3 bins: 0-1, 1-2, 2-3
(let's ignore cases of exact equality for simplicity). I would like the first bin to include all values from minus infinity to 1, and the last bin to include all values from 2 to infinity. However, if I explicitly set these bins to span that range, they will be very wide. I would like them to have the same width. The behavior I am looking for is like the behavior of hist()
in Matlab.
Obviously I can numpy.clip()
the data and plot that, which will give me what I want. But I am interested if there is a builtin solution for this.