plotting.plot_network_topology

plotting.plot_network_topology(
    network,
    *,
    solution=None,
    color_by=None,
    width_by=None,
    colorscale='Viridis',
    show_edge_labels=True,
    show_areas=False,
    title=None,
    height=None,
    width=None,
    positions=None,
)

Plot the element/edge topology of a :class:~nefes.shell.network.Network.

With no solution this is a structural view (no solve needed): the element graph with one arrow per directed edge. Pass a converged solution to overlay the solved field on the edges – the edges carry the state in Nefes, so a solved quantity (temperature, Mach, mass flow, …) is drawn on the edges: color_by tints each edge (with a colorbar) and width_by scales its arrow width.

Parameters

Name Type Description Default
network nefes.shell.network.Network The network to draw (elements and directed edges). required
solution nefes.shell.network.Solution A converged mean-flow solution of this network. Required for color_by / width_by; when given it also enriches the edge hover with mdot, T and M. None
color_by str Edge field to color the edges by (e.g. "T", "M", "mdot"; keys of :data:nefes.shell.network._EDGE_FIELDS). Adds a colorbar and labels each edge with its value. "area" needs no solve; every other field requires solution. None
width_by str Edge field whose magnitude scales the arrow width (e.g. "mdot" for a flow-weighted diagram, "area" for a geometry-weighted one). "area" needs no solve – it is the width :meth:Network.plot uses by default; every other field requires solution. None
colorscale str Plotly colorscale name for color_by (default "Viridis"). 'Viridis'
show_edge_labels bool Label each edge at its midpoint (the edge index, or the color_by value when coloring; default True). True
show_areas bool Append the edge area to the edge label (default False; always in hover). False
title str Figure title. Defaults to "Network topology", or names the overlaid field when color_by is set. None
height int Figure size in pixels. None
width int Figure size in pixels. None
positions mapping or array - like Explicit node coordinates, overriding the automatic layered layout. Either a mapping {element_index: (x, y)} or an (n, 2) array of (x, y) rows in element order. Use it to draw a network in its physical arrangement (a ring of cans, an annulus) instead of the default left-to-right layering. None

Returns

Name Type Description
plotly.graph_objects.Figure
Back to top