pypsa.Network.plot#
- Network.plot(margin=0.05, ax=None, geomap=True, projection=None, bus_colors='cadetblue', bus_alpha=1, bus_sizes=0.02, bus_cmap=None, bus_norm=None, bus_split_circles=False, line_colors='rosybrown', link_colors='darkseagreen', transformer_colors='orange', line_alpha=1, link_alpha=1, transformer_alpha=1, line_widths=1.5, link_widths=1.5, transformer_widths=1.5, line_cmap=None, link_cmap=None, transformer_cmap=None, line_norm=None, link_norm=None, transformer_norm=None, flow=None, branch_components=None, layouter=None, title='', boundaries=None, geometry=False, jitter=None, color_geomap=None)#
Plot the network buses and lines using matplotlib and cartopy.
- Parameters:
margin (float, defaults to 0.05) – Margin at the sides as proportion of distance between max/min x, y Will be ignored if boundaries are given.
ax (matplotlib ax, defaults to plt.gca()) – Axis to which to plot the network
geomap (bool/str, default True) – Switch to use Cartopy and draw geographical features. If string is passed, it will be used as a resolution argument, valid options are ‘10m’, ‘50m’ and ‘110m’.
projection (cartopy.crs.Projection, defaults to None) – Define the projection of your geomap, only valid if cartopy is installed. If None (default) is passed the projection for cartopy is set to cartopy.crs.PlateCarree
bus_colors (dict/pandas.Series) – Colors for the buses, defaults to “cadetblue”. If bus_sizes is a pandas.Series with a Multiindex, bus_colors defaults to the n.carriers[‘color’] column.
bus_alpha (float) – Adds alpha channel to buses, defaults to 1.
bus_sizes (dict/pandas.Series) – Sizes of bus points, defaults to 1e-2. If a multiindexed Series is passed, the function will draw pies for each bus (first index level) with segments of different color (second index level). Such a Series is ob- tained by e.g. n.generators.groupby([‘bus’, ‘carrier’]).p_nom.sum()
bus_cmap (plt.cm.ColorMap/str) – If bus_colors are floats, this color map will assign the colors
bus_norm (plt.Normalize|matplotlib.colors.*Norm) – The norm applied to the bus_cmap.
bus_split_circles (bool, default False) – Draw half circles if bus_sizes is a pandas.Series with a Multiindex. If set to true, the upper half circle per bus then includes all positive values of the series, the lower half circle all negative values. Defaults to False.
line_colors (str/pandas.Series) – Colors for the lines, defaults to ‘rosybrown’.
link_colors (str/pandas.Series) – Colors for the links, defaults to ‘darkseagreen’.
transfomer_colors (str/pandas.Series) – Colors for the transfomer, defaults to ‘orange’.
line_alpha (str/pandas.Series) – Alpha for the lines, defaults to 1.
link_alpha (str/pandas.Series) – Alpha for the links, defaults to 1.
transfomer_alpha (str/pandas.Series) – Alpha for the transfomer, defaults to 1.
line_widths (dict/pandas.Series) – Widths of lines, defaults to 1.5
link_widths (dict/pandas.Series) – Widths of links, defaults to 1.5
transformer_widths (dict/pandas.Series) – Widths of transformer, defaults to 1.5
line_cmap (plt.cm.ColorMap/str|dict) – If line_colors are floats, this color map will assign the colors.
link_cmap (plt.cm.ColorMap/str|dict) – If link_colors are floats, this color map will assign the colors.
transformer_cmap (plt.cm.ColorMap/str|dict) – If transformer_colors are floats, this color map will assign the colors.
line_norm (plt.Normalize|matplotlib.colors.*Norm) – The norm applied to the line_cmap.
link_norm (plt.Normalize|matplotlib.colors.*Norm) – The norm applied to the link_cmap.
transformer_norm (matplotlib.colors.Normalize|matplotlib.colors.*Norm) – The norm applied to the transformer_cmap.
flow (snapshot/pandas.Series/function/string) – Flow to be displayed in the plot, defaults to None. If an element of n.snapshots is given, the flow at this timestamp will be displayed. If an aggregation function is given, is will be applied to the total network flow via pandas.DataFrame.agg (accepts also function names). Otherwise flows can be specified by passing a pandas Series with MultiIndex including all necessary branch components. Use the line_widths argument to additionally adjust the size of the flow arrows.
layouter (networkx.drawing.layout function, default None) – Layouting function from networkx which overrules coordinates given in
n.buses[['x', 'y']]
. See list of available options.title (string) – Graph title
boundaries (list of four floats) – Boundaries of the plot in format [x1, x2, y1, y2]
branch_components (list of str) – Branch components to be plotted, defaults to Line and Link.
jitter (None|float) – Amount of random noise to add to bus positions to distinguish overlapping buses
color_geomap (dict or bool) – Specify colors to paint land and sea areas in. If True, it defaults to {‘ocean’: ‘lightblue’, ‘land’: ‘whitesmoke’}. If no dictionary is provided, colors are white. If False, no geographical features are plotted.
- Returns:
bus_collection, branch_collection1, … – Collections for buses and branches.
- Return type:
tuple of Collections