Hi, I want to generate histograms with fixed bars e.g. first
> one from 55 to 56, the second one from 56 to 57 and so on. What
> I found out so far, is that the hist command takes the array
> and defines the bar width automatically.
> Anyone, how to get fixed bars ?
How about replacing the hist function in axes.py with something like
def hist(self, x, bins=10, normed=0, bottom=0,
orientation='vertical', width=None, **kwargs):
HIST(x, bins=10, normed=0, bottom=0, orientiation='vertical', **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
The return values is (n, bins, patches)
If normed is true, the first element of the return tuple will
be the counts normalized to form a probability density, ie,
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left.
width: the width of the bars. If None, automatically compute
kwargs are used to update the properties of the
if not self._hold: self.cla()
n,bins = matplotlib.mlab.hist(x, bins, normed)
if width is not None: width = 0.9*(bins-bins)
patches = self.barh(n, bins, height=width, left=bottom)
patches = self.bar(bins, n, width=width, bottom=bottom)
for p in patches:
return n, bins, silent_list('Patch', patches)