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
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
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
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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
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
387 388 389 390 391 392 393 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 484 485 486 487 | |