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,
n/(len(x)*dbin)
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
the width.
kwargs are used to update the properties of the
hist bars
"""
if not self._hold: self.cla()
n,bins = matplotlib.mlab.hist(x, bins, normed)
if width is not None: width = 0.9*(bins[1]-bins[0])
if orientation=='horizontal':
patches = self.barh(n, bins, height=width, left=bottom)
else:
patches = self.bar(bins, n, width=width, bottom=bottom)
for p in patches:
p.update(kwargs)
return n, bins, silent_list('Patch', patches)
JDH