def plot_containment(self, fraction=0.68, ax=None, add_cbar=True, **kwargs):
    '\n        Plot containment image with energy and theta axes.\n\n        Parameters\n        ----------\n        fraction : float\n            Containment fraction between 0 and 1.\n        add_cbar : bool\n            Add a colorbar\n        '
    import matplotlib.pyplot as plt
    ax = (plt.gca() if (ax is None) else ax)
    energy = self.energy_axis_true.center
    offset = self.offset_axis.center
    containment = self.containment_radius(energy, offset, fraction)
    kwargs.setdefault('cmap', 'GnBu')
    kwargs.setdefault('vmin', np.nanmin(containment.value))
    kwargs.setdefault('vmax', np.nanmax(containment.value))
    x = energy.value
    y = offset.value
    caxes = ax.pcolormesh(x, y, containment.value, **kwargs)
    ax.semilogx()
    ax.set_ylabel(f'Offset ({offset.unit})')
    ax.set_xlabel(f'Energy ({energy.unit})')
    ax.set_xlim(x.min(), x.max())
    ax.set_ylim(y.min(), y.max())
    try:
        self._plot_safe_energy_range(ax)
    except KeyError:
        pass
    if add_cbar:
        label = f'Containment radius R{(100 * fraction):.0f} ({containment.unit})'
        ax.figure.colorbar(caxes, ax=ax, label=label)
    return ax
Plot containment image with energy and theta axes.

Parameters
----------
fraction : float
    Containment fraction between 0 and 1.
add_cbar : bool
    Add a colorbar
def plot_containment(self, fraction=0.68, ax=None, add_cbar=True, **kwargs):
    '\n        Plot containment image with energy and theta axes.\n\n        Parameters\n        ----------\n        fraction : float\n            Containment fraction between 0 and 1.\n        add_cbar : bool\n            Add a colorbar\n        '
    import matplotlib.pyplot as plt
    ax = (plt.gca() if (ax is None) else ax)
    energy = self.energy_axis_true.center
    offset = self.offset_axis.center
    containment = self.containment_radius(energy, offset, fraction)
    kwargs.setdefault('cmap', 'GnBu')
    kwargs.setdefault('vmin', np.nanmin(containment.value))
    kwargs.setdefault('vmax', np.nanmax(containment.value))
    x = energy.value
    y = offset.value
    caxes = ax.pcolormesh(x, y, containment.value, **kwargs)
    ax.semilogx()
    ax.set_ylabel(f'Offset ({offset.unit})')
    ax.set_xlabel(f'Energy ({energy.unit})')
    ax.set_xlim(x.min(), x.max())
    ax.set_ylim(y.min(), y.max())
    try:
        self._plot_safe_energy_range(ax)
    except KeyError:
        pass
    if add_cbar:
        label = f'Containment radius R{(100 * fraction):.0f} ({containment.unit})'
        ax.figure.colorbar(caxes, ax=ax, label=label)
    return ax