viz_plotly
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly ¤
Visualization for asset optimization reporting using Plotly.
Functions¤
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_battery_power ¤
Plot battery power and state of charge (SOC) over time.
Creates a Plotly figure visualizing battery behavior, including available power, charging, discharging, and SOC. The SOC is displayed on a secondary y-axis, while power-related traces share the primary axis.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure showing battery power flows and SOC. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_energy_trade ¤
plot_energy_trade(
df: DataFrame,
fig: Figure | None = None,
row: int | None = None,
) -> Figure
Plot the microgrid energy trade as a time-series chart.
Creates a Plotly figure showing bought and sold energy over time based on
the processed output of prepare_energy_trade_data. The function adds
separate traces for energy buy and sell values and optionally applies the
standard layout and range slider when used as a standalone figure.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
fig
|
Optional existing figure to which traces are added. If not provided,
a new
TYPE:
|
row
|
Optional subplot row index. When provided, the common layout and range slider are not applied, and axis padding is scoped to the specified subplot row.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the energy trade traces. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_monthly ¤
plot_monthly(df: DataFrame) -> tuple[Figure, DataFrame]
Plot monthly aggregated energy data as grouped bar charts.
Builds a Plotly bar chart showing positive and negative monthly energy
values returned by prepare_monthly_data. Positive values are plotted
as standard bars, while negative values are rendered with reduced opacity
for visual distinction.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing time-series data required by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[Figure, DataFrame]
|
The monthly aggregated DataFrame used for plotting. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_power_flow ¤
plot_power_flow(
df: DataFrame,
fig: Figure | None = None,
row: int | None = None,
) -> Figure
Plot the microgrid power flow as a stacked time-series chart.
Builds a Plotly figure showing the evolution of key power-flow components
over time, including on-site production (CHP and/or PV), battery charging and
discharging (when available), grid exchange, and total consumption. The input
data is normalized via prepare_power_flow_data before traces are added.
If no figure is provided, a new one is created. When row is not provided,
the function also applies the common layout and a range slider. Axis padding is
applied in all cases based on the combined y-range of the plotted series.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
fig
|
Optional existing figure to add traces to. If not provided, a new
TYPE:
|
row
|
Optional subplot row index. When provided, common layout and range slider configuration are skipped and axis padding is applied to the specified subplot row.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the power-flow traces. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
frequenz.lib.notebooks.reporting.asset_optimization.viz_plotly.plot_power_flow_trade ¤
Create a combined subplot showing power flow and energy trade.
Builds a two-row Plotly figure with shared x-axis: - The top subplot renders the power-flow visualization. - The bottom subplot renders the corresponding energy-trade visualization.
Traces from the underlying figures are merged into a single subplot layout and assigned to two separate legends (one per subplot). The figure applies a common layout configuration, axis styling, subplot-specific y-axis titles, and adds a range slider on the lower subplot.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input DataFrame containing the columns required by
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Figure
|
A Plotly figure containing the stacked power-flow and energy-trade |
Figure
|
subplots with independent legends and shared time navigation. |
Source code in src/frequenz/lib/notebooks/reporting/asset_optimization/viz_plotly.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |