plotter
frequenz.lib.notebooks.reporting.plotter ¤
Plotting functions for the reporting module.
Functions¤
frequenz.lib.notebooks.reporting.plotter.plot_energy_pie_chart ¤
Plot a donut pie chart for energy source contributions.
PARAMETER | DESCRIPTION |
---|---|
power_df
|
DataFrame with columns
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Figure
|
A Plotly |
Source code in frequenz/lib/notebooks/reporting/plotter.py
frequenz.lib.notebooks.reporting.plotter.plot_time_series ¤
plot_time_series(
df: DataFrame,
time_col: str | None = None,
cols: list[str] | None = None,
title: str = "Time Series Plot",
xaxis_title: str = "Timestamp",
yaxis_title: str = "kW",
legend_title: str = "Components",
color_dict: dict[str, str] | None = None,
) -> Figure
Plot a time series line chart with Plotly.
PARAMETER | DESCRIPTION |
---|---|
df
|
Input DataFrame containing a datetime column and one or more numeric columns.
TYPE:
|
time_col
|
Optional column name to use for the x-axis (time). If None, the DataFrame index is used.
TYPE:
|
cols
|
List of columns to plot. If None, all columns except |
title
|
Title of the plot.
TYPE:
|
xaxis_title
|
X-axis label.
TYPE:
|
yaxis_title
|
Y-axis label.
TYPE:
|
legend_title
|
Legend title.
TYPE:
|
color_dict
|
Optional mapping from column name to color hex/string. Values override the default Dark2 palette. |
RETURNS | DESCRIPTION |
---|---|
Figure
|
A Plotly |
Raises:
KeyError: If time_col
is provided but does not exist in df
.
Source code in frequenz/lib/notebooks/reporting/plotter.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|