Create Collections
Matplotlib collections can be created from pandapower networks with the following functions:
- pandapower.plotting.create_annotation_collection(texts, coords, size, prop=None, **kwargs)
Creates PatchCollection of Texts shown at the given coordinates
- Parameters:
texts (iterable of strings) – The texts to be
coords (iterable of tuples) – Coordinates to place the texts
size (float | list[float]) – Size of the texts
prop – FontProperties being passed to the TextPatches
- Keyword Arguments:
**kwargs – Will be passed to the PatchCollection.
- pandapower.plotting.create_bus_bus_switch_collection(net, size=1., helper_line_style=':', helper_line_size=1., helper_line_color='gray', switches=None, **kwargs)
Creates a matplotlib patch collection of pandapower bus-bus switches. Switches are plotted in the center between two buses with a “helper” line (dashed and thin) being drawn between the buses as well.
- Parameters:
net (pandapowerNet) – The pandapower network
size (float, 1.0) – Size of the switch patches
helper_line_style (string) – Line style of the “helper” line being plotted between two buses connected by a bus-bus switch. Defaults to ‘:’
helper_line_size (float, 1.0) – Line width of the “helper” line being plotted between two buses connected by a bus-bus switch
helper_line_color (string, "gray") – by a bus-bus switch
switches (list, []) – switches to include in the collection
- Keyword Arguments:
function (are passed to the patch)
- Returns:
tuple of patch 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, bus_table='bus', cbar_title='Bus Voltage [pu]', clim=None, plot_colormap=True, **kwargs)
Creates a matplotlib patch collection of pandapower buses.
- Parameters:
net (pandapowerNet) – The pandapower network
buses (list | None) – The buses for which the collections are created. If None, all buses in the network are considered.
size (float) – patch size
patch_type (str) –
patch type, can be
”circle” for a circle
”rect” for a rectangle
”poly<n>” for a polygon with n edges
infofunc (Callable | None) – info function 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 (Colormap, 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
clim (tuple of floats, None) – setting the norm limits for image scaling
bus_table (str, "bus") – element table to use for the buses (“bus”, “bus_dc”)
plot_colormap (bool, True) – flag whether the colormap is actually drawn
- Keyword Arguments:
function (are passed to the patch)
- Returns:
patch collection
- pandapower.plotting.create_busbar_collection(net, buses=None, infofunc=None, cmap=None, norm=None, picker=False, z=None, cbar_title='Bus Voltage [p.u.]', clim=None, **kwargs)
Creates a matplotlib patch collection of pandapower buses plotted as busbars
- Parameters:
net (pandapowerNet) – The pandapower network
buses (list, None) – The buses for which the collections are created. If None, all buses which have the entry coords in bus_geodata are considered.
line_geodata (DataFrame, None) – coordinates to use for plotting. If None, net[“line_geodata”] is used
infofunc (function, None) – infofunction for the line element
cmap – colormap for the line colors
norm – (matplotlib norm object, None): matplotlib norm object
picker (bool, False) – picker argument passed to the patch 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
- Keyword Arguments:
**kwargs – key word arguments are passed to the patch function
- Returns:
busbar collection
- pandapower.plotting.create_dcline_collection(net, dclines=None, line_geodata=None, infofunc=None, cmap=None, norm=None, picker=False, z=None, cbar_title='HVDC-Line Loading [%]', clim=None, plot_colormap=True, **kwargs)
Creates a matplotlib line collection of pandapower dclines.
- Parameters:
net (pandapowerNet) – The pandapower network
dclines (list, None) – The dclines for which the collections are created. If None,
considered. (all dclines in the network are)
bus_geodata (DataFrame, None) – coordinates to use for plotting If None, net[“bus_geodata”] is 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
plot_colormap (bool, True) – flag whether the colormap is actually drawn
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection
- pandapower.plotting.create_ext_grid_collection(net, ext_grids=None, size=1., infofunc=None, orientation=0, picker=False, ext_grid_buses=None, **kwargs)
Creates a matplotlib patch collection of pandapower ext_grid. Parameters ext_grids, ext_grid_buses can be used to specify, which ext_grids the collection should be created for.
- Parameters:
net (pandapowerNet) – The pandapower network
size (float, 1) – patch size
infofunc (function, None) – infofunction for the patch element
orientation (float, 0) – orientation of load collection. 0 is directed upwards, increasing values lead to clockwise direction changes.
picker (bool, False) – picker argument passed to the patch collection
ext_grid_buses (np.ndarray, None) – buses to be used as ext_grid locations
- Keyword Arguments:
function (are passed to the patch)
- Returns:
patch collection, patch collection
- pandapower.plotting.create_gen_collection(net, gens=None, size=1., infofunc=None, orientation=math.pi, picker=False, patch_type=None, unique_angles=None, draw_by_type=False, **kwargs)
Creates a matplotlib patch collection of pandapower gens.
- Parameters:
net (pandapowerNet) – The pandapower network
gens (list[int], None) – the generators to include in the collection
size (float, 1) – patch size
infofunc (function, None) – infofunction for the patch element
orientation (float or list[float], np.pi) – orientation of gen collection. pi is directed downwards, increasing values lead to clockwise direction changes.
picker (bool, False) – picker argument passed to the patch collection
patch_type (iterable[str], None) – patch types to use for each patch or a single type for all patches
unique_angles (dict) – angles for patches
draw_by_type (bool, False) – should gens be drawn grouped by type or as one patch
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
patch collection, line collection
- pandapower.plotting.create_impedance_collection(net, impedances=None, bus_geodata=None, infofunc=None, picker=False, **kwargs)
Creates a matplotlib line collection of pandapower lines.
- Parameters:
net (pandapowerNet) – The pandapower network
impedances (list, None) – The impedances for which the collections are created. If None, all impedance in the network are considered.
bus_geodata (DataFrame, None) – coordinates to use for plotting. If None, net[“bus_geodata”] is used infofunc (function, None): infofunction for the patch element
picker (bool, False) – picker argument passed to the line collection
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection
- 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, line_table='line', **kwargs)
Creates a matplotlib line collection of pandapower lines.
- Parameters:
net (pandapowerNet) – The pandapower network
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[“geo”] is used
bus_geodata (DataFrame, None) – coordinates to use for plotting. If None, net.bus[“geo”] is used
use_bus_geodata (bool, False) – Defines whether bus or line geodata are used. If False line_geodata is used, if not all lines have line geodata bus geodata is used aswell
infofunc (function, None) – information function for the patch element
cmap (Colormap) – 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
line_table (str, "line") – which element table to use (“line”, “line_dc”)
plot_colormap (bool, True) – flag whether the colormap is actually drawn
- Keyword Arguments:
function (Any that can be passed to the patch)
- Returns:
line collection
- pandapower.plotting.create_line_switch_collection(net, switches=None, size=1, distance_to_bus=3, use_line_geodata=False, **kwargs)
Creates a matplotlib patch collection of pandapower line-bus switches.
- Parameters:
net (pandapowerNet) – The pandapower network
size (float, 1) – Size of the switch patches
distance_to_bus (float, 3) – Distance of the switch patch from the bus patch
use_line_geodata (bool, False) – If True, line coordinates are used to identify the switch position
switch_index (list, []) – Possibility to create line switch collections with a subset of switches in net.switch.index. If left empty, all switches are taken into the line switch collection.
- Keyword Arguments:
function (are passed to the patch)
- Returns:
patch collection
- pandapower.plotting.create_load_collection(net, loads=None, size=1., infofunc=None, orientation=np.pi, picker=False, unique_angles=None, **kwargs)
Creates a matplotlib patch collection of pandapower loads.
- Parameters:
net (pandapowerNet) – The pandapower network
loads (list of ints, None) – the loads to include in the collectiona
size (float, 1) – patch size
infofunc (function, None) – infofunction for the patch element
orientation (float, np.pi) – orientation of load collection. pi is directed downwards, increasing values lead to clockwise direction changes.
picker (bool, False) – picker argument passed to the patch collection
unique_angles (dict) – angles for patches
- Keyword Arguments:
function (are passed to the patch)
- Returns:
patch collection, line collection
- pandapower.plotting.create_sgen_collection(net, sgens=None, size=1., infofunc=None, orientation=math.pi, picker=False, patch_type=None, unique_angles=None, draw_by_type=False, **kwargs)
Creates a matplotlib patch collection of pandapower sgen.
- Parameters:
net (pandapowerNet) – The pandapower network
sgens (list of ints, None) – the static generators to include in the collection
size (float, 1) – patch size
infofunc (function, None) – infofunction for the patch elem
picker (bool, False) – picker argument passed to the patch collection
orientation (float, np.pi) – orientation of static generator collection. pi is directed downwards, increasing values lead to clockwise direction changes.
patch_type (str or iterable[str], None)
unique_angles (dict) – angles for patches
draw_by_type (bool, False) – should sgens be drawn grouped by type or as one patch
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
patch collection, line collection
- pandapower.plotting.create_storage_collection(net, storages=None, size=1., infofunc=None, orientation=np.pi, picker=False, **kwargs)
Creates a matplotlib patch collection of pandapower storage element.
- Parameters:
net (pandapowerNet) – The pandapower network
storages (list of ints, None) – the net.storage.index values to include in the collection
size (float, 1) – patch size
infofunc (function, None) – info function for the patch element
picker (bool, False) – picker argument passed to the patch collection
orientation (float, np.pi) – orientation of static generator collection. pi is directed downwards, increasing values lead to clockwise direction changes.
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
patch collection, line collection
- pandapower.plotting.create_trafo3w_collection(net, trafo3ws=None, picker=False, infofunc=None, cmap=None, norm=None, z=None, clim=None, cbar_title='3W-Transformer Loading', plot_colormap=True, bus_geodata=None, **kwargs)
Creates a matplotlib line collection of pandapower transformers.
- Parameters:
net (pandapowerNet) – The pandapower network
trafo3ws (list, None) – The three winding transformers for which the collections are created. If None, all three winding transformers in the network are considered.
picker (bool, False) – picker argument passed to the patch collection
infofunc (function, None) – infofunction for the patch element
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection, patch collection or None, None
- pandapower.plotting.create_trafo3w_connection_collection(net, trafos=None, bus_geodata=None, infofunc=None, **kwargs)
Creates a matplotlib line collection of pandapower 3W-transformers. This function can be used to create line collections for voltage fall diagrams.
- Parameters:
net (pandapowerNet) – The pandapower network
trafos (list, None) – The 3W-transformers for which the collections are created. If None, all 3W-transformers in the network are considered.
bus_geodata (DataFrame, None) – coordinates to use for plotting. If None, net[“bus_geodata”] is used
infofunc (function, None) – infofunction for the patch element
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
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.
- Parameters:
net (pandapowerNet) – The pandapower network
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
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection and patch collection or None
- pandapower.plotting.create_trafo_connection_collection(net, trafos=None, bus_geodata=None, infofunc=None, cmap=None, clim=None, norm=None, z=None, cbar_title='Transformer Loading', picker=False, **kwargs)
Creates a matplotlib line collection of pandapower transformers.
- Parameters:
net (pandapowerNet) – The pandapower network
trafos (list, None) – The transformers for which the collections are created. If None, all transformers in the network are considered.
bus_geodata (DataFrame, None) – coordinates to use for plotting. If None, net[“bus_geodata”] is used
infofunc (function, None) – infofunction for the patch element
cmap – colormap for the patch colors
clim (tuple of floats, None) – setting the norm limits for image scaling
norm (matplotlib norm object, None) – matplotlib norm object
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
picker (bool, False) – picker argument passed to the line collection
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection
- pandapower.plotting.create_vsc_collection(net, vscs=None, picker=False, size=None, infofunc=None, cmap=None, norm=None, z=None, clim=None, cbar_title='VSC power', plot_colormap=True, bus_geodata=None, bus_dc_geodata=None, **kwargs)
Creates a matplotlib line collection of pandapower transformers.
- Parameters:
net (pandapowerNet) – The pandapower network
vscs (list, None) – The VSC indices for which the collections are created. If None, all VSCs in the grid are considered.
picker (bool, False) – picker argument passed to the patch collection
size (int, None) – size of VSC symbol squares. Should be > 0 and < 0.35*bus_distance
infofunc (function, None) – infofunction for the patch element
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection, patch collection or None
- pandapower.plotting.create_vsc_connection_collection(net, vscs=None, bus_geodata=None, bus_dc_geodata=None, infofunc=None, cmap=None, clim=None, norm=None, z=None, cbar_title='Transformer Loading', picker=False, **kwargs)
Creates a matplotlib line collection of pandapower VSCs.
- Parameters:
net (pandapowerNet) – The pandapower network
vscs (list, None) – The VSC indices for which the collections are created. If None, all VSCs in the network are considered.
bus_geodata (DataFrame, None) – coordinates of AC buses to use for plotting. If None, net[“bus_geodata”] is used
bus_dc_geodata (DataFrame, None) – coordinates of DC buses to use for plotting. If None, net[“bus_dc_geodata”] is used
infofunc (function, None) – infofunction for the patch element
cmap – colormap for the patch colors
clim (tuple of floats, None) – setting the norm limits for image scaling
norm (matplotlib norm object, None) – matplotlib norm object
z (array, None) – array of values for colormap. Used in case of given cmap. If None net.res_vsc.p_mw is used.
cbar_title (str, "VSC active power [MW]") – colormap bar title in case of given cmap
picker (bool, False) – picker argument passed to the line collection
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
line collection
- pandapower.plotting.create_ward_collection(net, wards=None, ward_buses=None, size=5., bus_geodata=None, infofunc=None, picker=False, orientation=0, **kwargs)
Creates a matplotlib patch collection of pandapower wards. Wards are plotted as a grounded impedance.
- Parameters:
net (pandapowerNet) – The pandapower network
wards (list of ints, None) – the wards to include in the collection
ward_buses (list of ints, None) – the buses connected to the wards
size (float, 1) – patch size
infofunc (function, None) – infofunction for the patch elem
picker (bool, False) – picker argument passed to the patch collection
orientation (float, np.pi) – orientation of static generator collection. pi is directed downwards, increasing values lead to clockwise direction changes.
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
patch collection, line collection
- pandapower.plotting.create_xward_collection(net, xwards=None, xward_buses=None, size=5., bus_geodata=None, infofunc=None, picker=False, orientation=0, **kwargs)
Creates a matplotlib patch collection of pandapower xwards. Extended wards are plotted as a grounded impedance with a generator.
- Parameters:
net (pandapowerNet) – The pandapower network
xwards (list of ints, None) – the wards to include in the collection
xward_buses (list of ints, None) – the buses connected to the wards
size (float, 1) – patch size
infofunc (function, None) – infofunction for the patch elem
picker (bool, False) – picker argument passed to the patch collection
orientation (float, np.pi) – orientation of static generator collection. pi is directed downwards, increasing values lead to clockwise direction changes.
- Keyword Arguments:
**kwargs – are passed to the patch function
- Returns:
patch collection, line collection