optiwindnet.svg¶
Module Contents¶
- class optiwindnet.svg.SvgRepr(data: str)[source]¶
Helper class to get IPython to display the SVG figure encoded in data.
- optiwindnet.svg.svgplot(G: networkx.Graph, *, landscape: bool = True, infobox: bool = True, dark: bool | None = None, transparent: bool = True, node_size: int = 12, 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’.
infobox – add(?) text box with summary of G’s main properties: capacity, number of turbines, excess feeders, total feeders, total cable length.
dark – color theme to use: True -> dark; False: light; None -> guess
transparent – background color: True -> transparent; False -> theme-based
- Returns:
SvgRepr object containing the SVG markup in its ‘data’ attribute