plot_static_per_carrier(ds, ax, drop_zero_vals=True)
Generic function to plot different statics
Parameters: |
|
---|
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")