app.infra.visualize
annotate_buses(ax, net, label='name', fontsize=16, offset=(0.0, 0.0), bbox=True, filter_fn=None)
Annotate buses on a matplotlib axis created by pandapower.simple_plot.
Parameters - ax: matplotlib Axes where the network was drawn - net: pandapower network - label: "name", "index" or any column name from net.bus (e.g. "vm_pu") - fontsize: text size - offset: (dx, dy) offset in data coordinates to move labels from bus position - bbox: whether to draw a semi-transparent background box - filter_fn: optional function (idx, row) -> bool to skip some buses
draw_battery_icon(ax, x, y, size=0.02, color='blue')
Draw a stylized battery centered at (x, y). - size: fractional size relative to axis span (0.02 = 2% of axis span)
fit_network_axis(ax, net, padx=0.05, pady=0.05, min_span=1e-06, ymargin=0, xmargin=0)
Tighten ax limits to the extents of net.bus['x','y'] with a fractional padding.
- pad: fraction of span to add on each side (0.05 = 5%)
- min_span: avoid zero-span if all coords identical
plot_branch_voltage_heatmaps(results, branch_buses, bus_names, scenario_names=None, cmap='Greys', figsize=(12, 3.5), savepath=None)
Plot stacked heatmaps (max, mean, min) of node voltages along a branch for multiple scenarios.
Parameters - results: list of CSV file paths or pandas DataFrames. Each entry corresponds to one scenario. Each DataFrame must contain a column identifying the bus (e.g. 'bus','node','bus_name') and a voltage column (e.g. 'vm_pu','vm','voltage'). - branch_buses: ordered list of bus names (x-axis). - scenario_names: optional list of names for the scenarios (y-axis). If None, indices are used. - cmap: matplotlib colormap name (defaults to 'Greys' to match network plotting). - figsize: figure size tuple. - savepath: if provided, save the figure to this path.
Returns: - (fig, axes): Matplotlib figure and array of axes.
plot_losses_violations_heatmaps(results, net, scenario_names=None, cmap='Greys', figsize=(10, 6), savepath=None, violation_threshold=1.01)
Plot two heatmaps (losses, voltage violations) across scenarios. - results: list of CSV paths or pandas DataFrames (each scenario) - net: pandapower network (used to get line r and length) - returns (fig, axes)
visualize_high_voltage_day(net, results_csv=None, results_df=None, branches=None, figsize=(16, 10), cmap='RdYlBu_r', base_year=2016, output_path=None, scenario=None, trafo=4, remove_battery=False)
Visualize network snapshot at the highest voltage timestep.