Plotting

Two-dimensional histogram plotting.

class heppy.panel(title='', height=1.0, xlabel='', ylabel='', logx=False, logy=False, stack=None, curves=[], bands=[], points=[], pointshift=0.0, ylims=None, nolegend=False, legend_title=None)

A panel holds histograms and other information that describe a panel of a plot

Parameters:
  • title (str) – title of the panel
  • height (float) – relative height of the panel with respect to any other panels in a plot
  • xlabel (str) – x-axis label
  • ylabel (str) – y-axis label
  • logx (bool) – plot x-axis on a logarithmic scale?
  • logy (bool) – plot y-axis on a logarithmic scale?
  • stack (heppy.histostack, or None) – histogram stack to plot
  • curves (list of heppy.histogram1d) – histograms to plot as curves
  • bands (list of heppy.histogram1d) – histograms to plot as (uncertainty) bands
  • points (list of heppy.histogram1d) – histograms to plot as points located at the centre of each of their bins
  • pointshift (float) – distance to shift points by horizontally to avoid overlap and improve readability. This functionality is poorly tested and may be broken
  • ylims (tuple of float, or None) – can be used to manually set lower and upper y-axis limits, e.g. ylims=(0.0, 2.0)
  • legend_title (str) – legend title
heppy.make_figure(panels, title='', figsize=(8, 5), write='', xmax=None, legend_outside=False)
Parameters:
  • panels (heppy.panel or list of heppy.panel) – panel(s) to visualise in the plot
  • title (str) – plot title
  • write (str) – may be changed to a filename, which will result in the figure being rendered and saved at the given location
  • legend_outside (bool) – option to move the legend next to the plot panels. It also changes the legend style to try to make it look better next to the plot: no box, text wrapped at 30 characters (not tested with LaTeX rendering — proceed with caution), smaller text (fontsize=’small’)
Returns:

tuple of the created plt.figure object and plt.axes objects. These can be assigned to variables by the user to allow further manipulations of the plot (style, contents, etc.)

heppy.make_uncertainty_breakdown(histogram, separator='__', ylims=None, xlabel='', **kwargs)

@histogram: heppy.histogram object for which the uncertainty breakdown figure will be made @separator: string that separates high/low (up/down, …) indictator from the rest of the uncertainty name, e.g.

“jet_energy_scale__1up” and “jet_energy_scale__1down” uses the separator “__”

@ylims: may be set to a tuple/list of lower and upper y-axis limits, e.g. ylims=(0.0, 2.0) @**kwargs: get passed on to make_figure()