To compare two histograms you can plot a bihistogram as suggested on
http://www.itl.nist.gov/div898/handbook/eda/section3/bihistog.htm

The little function I've written to do so is below. See if it helps.

Antonio



import scipy
from pylab import figure

def bihist(y1, y2, nbins=10, h=None):
        '''
        Bihistogram.
        h is an axis handle. If not present, a new figure is created.
        '''
        if h is None: h = figure().add_subplot(111)
        xmin = scipy.floor(scipy.minimum(y1.min(), y2.min()))
        xmax = scipy.ceil(scipy.maximum(y1.max(), y2.max()))
        bins = scipy.linspace(xmin, xmax, nbins)
        n1, bins1, patch1 = h.hist(y1, bins)
        n2, bins2, patch2 = h.hist(y2, bins)
        # set ymax:
        ymax = 0
        for i in patch1:
                height = i.get_height()
                if height > ymax: ymax = height
        # invert second histogram and set ymin:
        ymin = 0
        for i in patch2:
                height = i.get_height()
                height = -height
                i.set_height(height)
                if height < ymin: ymin = height
        h.set_ylim(ymin*1.1, ymax*1.1)          
        h.figure.canvas.draw()

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to