rootpy.plotting.root2matplotlib: matplotlib Interface

This module provides functions that allow the plotting of ROOT histograms and graphs with matplotlib.

If you just want to save image files and don’t want matplotlib to attempt to create a graphical window, tell matplotlib to use a non-interactive backend such as Agg when importing it for the first time (i.e. before importing rootpy.plotting.root2matplotlib):

import matplotlib
matplotlib.use('Agg') # do this before importing pyplot or root2matplotlib

This puts matplotlib in a batch state similar to ROOT.gROOT.SetBatch(True).


plotting.root2matplotlib.hist(hists[, ...]) Make a matplotlib hist plot from a ROOT histogram, stack or list of histograms.[, ...]) Make a matplotlib bar plot from a ROOT histogram, stack or list of histograms.
plotting.root2matplotlib.errorbar(hists[, ...]) Make a matplotlib errorbar plot from a ROOT histogram or graph or list of histograms and graphs.
plotting.root2matplotlib.fill_between(a, b) Fill the region between two histograms or graphs.
plotting.root2matplotlib.step(h[, logy, axes]) Make a matplotlib step plot from a ROOT histogram.
plotting.root2matplotlib.hist2d(h[, axes, ...]) Draw a 2D matplotlib histogram plot from a 2D ROOT histogram.
plotting.root2matplotlib.imshow(h[, axes, ...]) Draw a matplotlib imshow plot from a 2D ROOT histogram.
plotting.root2matplotlib.contour(h[, axes, ...]) Draw a matplotlib contour plot from a 2D ROOT histogram.