plot2d

coffea.hist.plot2d(hist, xaxis, ax=None, clear=True, xoverflow='none', yoverflow='none', patch_opts=None, text_opts=None, density=False, binwnorm=None)[source]

Create a 2D plot from a 2D Hist object

Parameters:
  • hist (Hist) – Histogram with two dimensions

  • xaxis (str or Axis) – Which of the two dimensions to use as an x axis

  • ax (matplotlib.axes.Axes, optional) – Axes object (if None, one is created)

  • clear (bool, optional) – Whether to clear Axes before drawing (if passed); if False, this function will skip drawing the legend

  • xoverflow (str, optional) – If overflow behavior is not ‘none’, extra bins will be drawn on either end of the nominal x axis range, to represent the contents of the overflow bins. See Hist.sum documentation for a description of the options.

  • yoverflow (str, optional) – Similar to xoverflow

  • patch_opts (dict, optional) – Options passed to the matplotlib pcolormesh call internal to this function, to plot a rectangular grid of patches colored according to the bin values. Leave empty for defaults.

  • text_opts (dict, optional) – Options passed to the matplotlib text call internal to this function, to place a text label at each bin center with the bin value. Special options interpreted by this function and not passed to matplotlib: ‘format’: printf-style float format , default ‘%.2g’.

  • density (bool, optional) – If true, convert sum weights to probability density (i.e. integrates to 1 over domain of axis) (Note: this option conflicts with binwnorm)

  • binwnorm (float, optional) – If true, convert sum weights to bin-width-normalized, with unit equal to supplied value (usually you want to specify 1.)

Returns:

ax – A matplotlib Axes object

Return type:

matplotlib.axes.Axes