finesse.model.Model.plot_graph¶
- Model.plot_graph(layout: str = 'neato', graphviz=True, network_type: str | finesse.utilities.network_filter.NetworkType = NetworkType.COMPONENT, root: str | finesse.element.ModelElement | finesse.components.node.Node | None = None, show_detectors: bool = False, radius: int | None = None, directed: bool = False, path: pathlib._local.Path | None = None, show: bool = True, format: Literal['png', 'svg'] = 'svg', **kwargs)[source]¶
Plot the node network. See also Visualizing the model
- Parameters
- layoutstr, optional
The networkx plotting layout engine, see NetworkX manual for more details. Choose from:
circular, fruchterman_reingold, kamada_kawai, multipartite, planar, random, shell, spectral, spiral, spring, neato, dot, fdp, sfdp, or circo
- graphvizbool, optional
Whether to use the graphviz library for better node layouts (needs optional dependency), by default True
- network_typestr | NetworkType, optional
Which network to plot, can be one of ‘optical’, ‘component’, ‘full’, by default NetworkType.COMPONENT
- rootstr | ModelElement | Node | None, optional
In combination with
radius
, the root node of the graph to use for distance based filtering, by defaultNone
. Whennetwork_type
iscomponents
,None
will default to the firstfinesse.components.laser.Laser
found in the model.- show_detectorsbool, optional
Whether to add detectors to the graph, by default False
- radiusint >= 1 | None, optional
Must be used in combination with
root
, only include nodes of the network that areradius
or less edges away from the root node, by default None, meaning that no nodes are filtered out.- directedbool, optional
Whether to use directed distance-based filtering, by default False. If set to True, will only include outgoing edges from the root node. See also the
undirected
argument ofnetworkx.generators.ego.ego_graph()
- pathPath | None, optional
Save the resulting image to the given path. Defaults to None, which saves in a temporary file that is displayed if ‘show’ is set to True.
- showbool, optional
Whether to show the resulting image. In Jupyter environments, shows the plot inline, otherwise opens a webbrowser for svgs and PIL for pngs. Defaults to True.
Notes
Uses
networkx.generators.ego.ego_graph()
for the distance-based filtering.