optiwindnet.plotting¶

Module Contents¶

optiwindnet.plotting.gplot(G: networkx.Graph, ax: matplotlib.axes.Axes | None = None, node_tag: str | bool | None = None, landscape: bool = True, infobox: bool = True, scalebar: tuple[float, str] | None = None, hide_ST: bool = True, legend: bool = False, min_dpi: int = 192, dark: bool | None = None, tag_border: bool = False, **kwargs) matplotlib.axes.Axes[source]¶

Plot site and routeset contained in G.

This function relies on matplotlib and networkx’s drawing functions. If no Axes instance is provided, a Figure with a single Axes will be created. Extra arguments given to gplot() will be forwarded to Figure().

Parameters:
  • ax – Axes instance to plot into. If None, opens a new figure.

  • node_tag – text tag inside each node (e.g. ‘load’, ‘label’ or any of the nodes’ attributes). If True, tags the nodes with their numbers.

  • tag_border – if True, all border and obstacle vertices get a number tag.

  • landscape – True -> rotate the plot by G’s attribute ‘landscape_angle’.

  • infobox – Draw text box with summary of G’s main properties: capacity, number of turbines, number of feeders, total cable length.

  • scalebar – (span_in_data_units, label) add a small bar to indicate the plotted features’ scale (lower right corner).

  • hide_ST – If coordinates include a Delaunay supertriangle, adjust the viewport to fit only the actual vertices (i.e. no ST vertices).

  • legend – Add description of linestyles and node shapes.

  • min_dpi – Minimum dots per inch to use. matplotlib’s default is used if it is greater than this value.

  • **kwargs – passed on to matplotlib’s Figure()

Returns:

Axes instance containing the plot.

optiwindnet.plotting.pplot(P: networkx.PlanarEmbedding, A: networkx.Graph, **kwargs) matplotlib.axes.Axes[source]¶

Plot PlanarEmbedding P using coordinates from A.

Wrapper for .plotting.gplot(). Performs what one would expect from gplot(P, …) - which does not work because P lacks coordinates and node ‘kind’ attribute. The source needs to be A (as opposed to G or L) because only A has the supertriangle’s vertices coordinates.

Parameters:
  • P – Planar embedding to plot.

  • A – source of vertex coordinates and ‘kind’.

Returns:

Axes instance containing the plot.