optiwindnet.svg =============== .. py:module:: optiwindnet.svg Module Contents --------------- .. py:class:: SvgRepr(data: str, metadata: dict[str, Any] | None = None) Helper class to get IPython to display the SVG figure encoded in data. .. py:attribute:: data .. py:attribute:: metadata :type: dict[str, Any] .. py:method:: __repr__() -> str .. py:method:: save(filepath: str) -> None write SVG to file `filepath` .. py:function:: 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 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. :param G: graph to plot :param landscape: rotate(?) the plot by G's graph attribute 'landscape_angle'. :param node_tag: text label inside each node. Use True for node numbers, 'load' for power flow values (requires has_loads), or any node attribute name. :param tag_border: if True, label all border and obstacle vertices with their index numbers (useful for geometry debugging). :param infobox: add(?) text box with summary of G's main properties: capacity, number of turbines, excess feeders, total feeders, total cable length. :param legend: if True, add a legend strip at the bottom of the SVG plot. :param dark: color theme to use: True -> dark; False: light; None -> guess :param transparent: background color: True -> transparent; False -> theme-based :returns: SvgRepr object containing the SVG markup in its 'data' attribute .. py:function:: svgpplot(P: networkx.PlanarEmbedding, A: networkx.Graph, **kwargs) -> SvgRepr Plot PlanarEmbedding `P` using coordinates from `A` as SVG markup. SVG equivalent of `plotting.pplot()`. Accepts the same keyword arguments as `svgplot()`. :param P: planar embedding to plot. :param A: source of vertex coordinates and node attributes. :returns: SvgRepr object containing the SVG markup in its 'data' attribute