https://github.com/gwastro/pycbc
Raw File
Tip revision: 8aeee4cf64797f10ec76f4afb60ba607fbd2d3c3 authored by Larne Pekowsky on 16 October 2015, 21:10:38 UTC
Set release version to 1.2.2
Tip revision: 8aeee4c
plot.py
""" Plotting utililities and premade plot configurations
"""

def hist_overflow(val, val_max, **kwds):
    """ Make a histogram with an overflow bar above val_max """
    import pylab, numpy

    overflow = len(val[val>=val_max])
    pylab.hist(val[val<val_max], **kwds)
        
    if 'color' in kwds:
        color = kwds['color']
    else:
        color = None    
 
    if overflow > 0:
        rect = pylab.bar(val_max+0.05, overflow, .5, color=color)[0]
        pylab.text(rect.get_x(), 
                   1.10*rect.get_height(), '%s+' % val_max)
    
back to top