Create Collections

Matplotlib collections can be created from pandapower networks with the following functions:

Bus Collections

pandapower.plotting.create_bus_collection(net, buses=None, size=5, patch_type='circle', color=None, z=None, cmap=None, norm=None, infofunc=None, picker=False, bus_geodata=None, cbar_title='Bus Voltage [pu]', **kwargs)

Creates a matplotlib patch collection of pandapower buses.

Input:

net (pandapowerNet) - The pandapower network

OPTIONAL:

buses (list, None) - The buses for which the collections are created. If None, all buses in the network are considered.

size (int, 5) - patch size

patch_type (str, “circle”) - patch type, can be

  • “circle” for a circle

  • “rect” for a rectangle

  • “poly<n>” for a polygon with n edges

infofunc (function, None) - infofunction for the patch element

color (list or color, None) - color or list of colors for every element

z (array, None) - array of bus voltage magnitudes for colormap. Used in case of given cmap. If None net.res_bus.vm_pu is used.

cmap (ListedColormap, None) - colormap for the patch colors

norm (matplotlib norm object, None) - matplotlib norm object

picker (bool, False) - picker argument passed to the patch collection

bus_geodata (DataFrame, None) - coordinates to use for plotting If None, net[“bus_geodata”] is used

cbar_title (str, “Bus Voltage [pu]”) - colormap bar title in case of given cmap

**kwargs - key word arguments are passed to the patch function

OUTPUT:

pc - patch collection

Branch Collections

pandapower.plotting.create_line_collection(net, lines=None, line_geodata=None, bus_geodata=None, use_bus_geodata=False, infofunc=None, cmap=None, norm=None, picker=False, z=None, cbar_title='Line Loading [%]', clim=None, plot_colormap=True, **kwargs)

Creates a matplotlib line collection of pandapower lines.

Input:

net (pandapowerNet) - The pandapower network

OPTIONAL:

lines (list, None) - The lines for which the collections are created. If None, all lines in the network are considered.

line_geodata (DataFrame, None) - coordinates to use for plotting. If None, net[“line_geodata”] is used

bus_geodata (DataFrame, None) - coordinates to use for plotting If None, net[“bus_geodata”] is used

use_bus_geodata (bool, False) - Defines whether bus or line geodata are used.

infofunc (function, None) - infofunction for the patch element

cmap - colormap for the patch colors

norm (matplotlib norm object, None) - matplotlib norm object

picker (bool, False) - picker argument passed to the line collection

z (array, None) - array of line loading magnitudes for colormap. Used in case of given cmap. If None net.res_line.loading_percent is used.

cbar_title (str, “Line Loading [%]”) - colormap bar title in case of given cmap

clim (tuple of floats, None) - setting the norm limits for image scaling

**kwargs - key word arguments are passed to the patch function

OUTPUT:

lc - line collection

pandapower.plotting.create_trafo_collection(net, trafos=None, picker=False, size=None, infofunc=None, cmap=None, norm=None, z=None, clim=None, cbar_title='Transformer Loading', plot_colormap=True, bus_geodata=None, **kwargs)

Creates a matplotlib line collection of pandapower transformers.

Input:

net (pandapowerNet) - The pandapower network

OPTIONAL:

trafos (list, None) - The transformers for which the collections are created. If None, all transformers in the network are considered.

picker (bool, False) - picker argument passed to the patch collection

size (int, None) - size of transformer symbol circles. Should be >0 and < 0.35*bus_distance

infofunc (function, None) - infofunction for the patch element

**kwargs - key word arguments are passed to the patch function

OUTPUT:

lc - line collection

pc - patch collection