dantro.plot_creators.ext_funcs._utils module

A module that implements a bunch of plot utilities used in the plotting functions. These can be shared tools between the plotting functions.

dantro.plot_creators.ext_funcs._utils.plot_errorbar(*, ax, x: numpy.ndarray, y: numpy.ndarray, yerr: numpy.ndarray, fill_between: bool = False, fill_between_kwargs: dict = None, **errorbar_kwargs)[source]

Given the data and (optionally) the y-error data, plots a single errorbar line. With fill_between=True, a shaded area is plotted instead of the errorbar markers.

The following fill_between_kwargs defaults are assumed:

  • color = line_color

  • alpha = 0.2 * line_alpha

  • lw = 0.

Parameters
  • ax – The axis to plot on

  • x (np.ndarray) – The x data to use

  • y (np.ndarray) – The y-data to use for ax.errorbar. Needs to be 1D and have coordinates associated which will be used for the x-values.

  • yerr (np.ndarray) – The y-error data

  • fill_between (bool, optional) – Whether to use plt.fill_between or plt.errorbar to plot y-errors

  • fill_between_kwargs (dict, optional) – Passed on to plt.fill_between

  • **errorbar_kwargs – Passed on to plt.errorbar

Raises

ValueError – On non-1D data

Returns

The matplotlib legend handle of the errorbar line or of the errorbands