plot_static_per_carrier(ds, ax, drop_zero_vals=True)

Generic function to plot different statics

Parameters:
  • ds (DataFrame) –

    the data to plot

  • ax (Axes) –

    plotting axes

  • drop_zero_vals (bool, default: True ) –

    Drop zeroes from data. Defaults to True.

Source code in workflow/scripts/plot_statistics.py
def plot_static_per_carrier(ds: DataFrame, ax: axes.Axes, drop_zero_vals=True):
    """Generic function to plot different statics

    Args:
        ds (DataFrame): the data to plot
        ax (matplotlib.axes.Axes): plotting axes
        drop_zero_vals (bool, optional): Drop zeroes from data. Defaults to True.
    """
    if drop_zero_vals:
        ds = ds[ds != 0]
    ds = ds.dropna()
    c = colors[ds.index.get_level_values("carrier")]
    ds = ds.pipe(rename_index)
    label = f"{ds.attrs['name']} [{ds.attrs['unit']}]"
    ds.plot.barh(color=c.values, xlabel=label, ax=ax)
    ax.grid(axis="y")