optiwindnet.svg¶
Module Contents¶
- class optiwindnet.svg.SvgRepr(data: str, metadata: dict[str, Any] | None = None)[source]¶
Helper class to get IPython to display the SVG figure encoded in data.
- optiwindnet.svg.svgplot(G: networkx.Graph, *, landscape: bool = True, node_tag: str | bool | None = None, tag_border: bool = False, infobox: bool = True, legend: bool = False, dark: bool | None = None, transparent: bool = True, github_bugfix: bool = True) SvgRepr[source]¶
Draw a NetworkX graph representation as SVG markup.
If using interactively (e.g. Jupyter notebook), the returned object must either be the cell’s output or be passed to IPython’s display() function.
Alternative to own.plotting.gplot() because matplotlib’s svg backend does not make efficient use of SVG primitives.
- Parameters:
G – graph to plot
landscape – rotate(?) the plot by G’s graph attribute
'landscape_angle'.node_tag – text label inside each node. Use
Truefor node numbers,'load'for power flow values (requireshas_loads), or any node attribute name.tag_border – if
True, label all border and obstacle vertices with their index numbers (useful for geometry debugging).infobox – add(?) text box with summary of G’s main properties: capacity, number of turbines, excess feeders, total feeders, total cable length.
legend – if
True, add a legend strip at the bottom of the SVG plot.dark – color theme to use:
True→ dark;False: light;None→ guesstransparent – background color:
True→ transparent;False→ theme-based
- Returns:
SvgRepr object containing the SVG markup in its
'data'attribute
- optiwindnet.svg.svgpplot(P: networkx.PlanarEmbedding, A: networkx.Graph, **kwargs) SvgRepr[source]¶
Plot PlanarEmbedding
Pusing coordinates fromAas SVG markup.SVG equivalent of
plotting.pplot(). Accepts the same keyword arguments assvgplot().- Parameters:
P – planar embedding to plot.
A – source of vertex coordinates and node attributes.
- Returns:
SvgRepr object containing the SVG markup in its
'data'attribute