[PATCH] multiple histograms on one axes

Hi,

since I have the need of multiple histograms on one axes to compare
different distributions and this feature was quite often requested
in the past on this list I have written a new method for the axes
class to implement this.

This method 'multihist' works essentially the same as the original
hist method. The input data is given as first non keyword argument
which has to be a sequence of sequences containing the different
data sets. Additionally three new parameters to the original hist
parameters (whose semantics have not changed) where introduced:

type = 'overlap' | 'beside' | 'bi'. This denotes how the different
histograms are rendered (either overlapping, with the bars beside
each other or as suggested in a previous post as bihistogram, see:

http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm

gap: the gap between bars when in 'beside' mode

patch_kwargs: this is a sequence of dicts containing the kwargs
that are passed to the bar/barh methods for generating the bar
patches. With these the look of the different patches for each
data set can be assigned.

The method returns (similar to hist)

xn, bins, patch_list

where xn is a sequence of the histogram data sets, bins are the
shared bins (no sequence) ad patch_list is a sequence of the
different patch sets for each data set

Please see the attached patch and example program for details.

I'd be happy to hear If you find this useful - especially since
I haven't tested many corner cases (different widths, orientations, bottoms etc.)
and cooked this up rather quickly.

Thanks,

Mario Oschwald

multihist.patch (3.74 KB)

multihist_demo.py (1.33 KB)