rootpy.plotting.root2matplotlib.bar

rootpy.plotting.root2matplotlib.bar(hists, stacked=True, reverse=False, xerr=False, yerr=True, xpadding=0, ypadding=0.1, yerror_in_padding=True, rwidth=0.8, snap=True, axes=None, **kwargs)[source]

Make a matplotlib bar 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 or string, 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. If ‘cluster’, then the bars will be arranged side-by-side.

reverse : bool, optional (default=False)

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

xerr : bool, optional (default=False)

If True, x error bars will be displayed.

yerr : bool or string, optional (default=True)

If False, no y errors are displayed. If True, an individual y error will be displayed for each hist in the stack. If ‘linear’ or ‘quadratic’, a single error bar will be displayed with either the linear or quadratic sum of the individual errors.

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.

rwidth : float, optional (default=0.8)

The relative width of the bars as a fraction of the bin width.

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 bar function.

Returns:

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

values if a stack or list of histograms was plotted.