https://github.com/gwastro/pycbc
Raw File
Tip revision: c3949fb5911301e7fc9f3e9e03ac5e8a009c82f7 authored by Ian Harry on 29 January 2020, 16:36:01 UTC
Prep. for release (#3113)
Tip revision: c3949fb
plot.py
""" Plotting utilities 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