rootpy.plotting.root2matplotlib.hist

rootpy.plotting.root2matplotlib.hist(hists, stacked=True, reverse=False, xpadding=0, ypadding=0.1, yerror_in_padding=True, logy=None, snap=True, axes=None, **kwargs)[source]

Make a matplotlib hist plot from a ROOT histogram, stack or list of histograms.

Parameters:

hists : Hist, list of Hist, HistStack

The histogram(s) to be plotted

stacked : bool, optional (default=True)

If True then stack the histograms with the first histogram on the bottom, otherwise overlay them with the first histogram in the background.

reverse : bool, optional (default=False)

If True then reverse the order of the stack or overlay.

xpadding : float or 2-tuple of floats, optional (default=0)

Padding to add on the left and right sides of the plot as a fraction of the axes width after the padding has been added. Specify unique left and right padding with a 2-tuple.

ypadding : float or 2-tuple of floats, optional (default=.1)

Padding to add on the top and bottom of the plot as a fraction of the axes height after the padding has been added. Specify unique top and bottom padding with a 2-tuple.

yerror_in_padding : bool, optional (default=True)

If True then make the padding inclusive of the y errors otherwise only pad around the y values.

logy : bool, optional (default=None)

Apply special treatment of a log-scale y-axis to display the histogram correctly. If None (the default) then automatically determine if the y-axis is log-scale.

snap : bool, optional (default=True)

If True (the default) then the origin is an implicit lower bound of the histogram unless the histogram has both positive and negative bins.

axes : matplotlib Axes instance, optional (default=None)

The axes to plot on. If None then use the global current axes.

kwargs : additional keyword arguments, optional

All additional keyword arguments are passed to matplotlib’s fill_between for the filled regions and matplotlib’s step function for the edges.

Returns:

The return value from matplotlib’s hist function, or list of such return

values if a stack or list of histograms was plotted.