visualise_network#

visualise_network(domain, network_name=None, edge_weight_name='Distance', edge_cmap='Greys_r', edge_width=1, edge_vmin=None, edge_vmax=None, add_cbar=True, ax=None, figure_kwargs={}, visualise_kwargs={})#

Visualise a network within a given domain.

This function visualises a specified network from a domain, optionally using edge weights for coloring. Network node objects are visualised using the visualise function from muspan.visualise. To modify the visualisation of the objects, you can pass additional keyword arguments to the visualise function via visualise_kwargs.

Parameters:
domainobject

The domain containing the network and objects to be visualised.

network_namestr, optional

The name of the network to visualise. If None, defaults to the first network in the domain.

edge_weight_namestr, optional

The name of the edge attribute to use for edge weights. Use ‘None’ to visualise the unweighted network. Default is ‘Distance’.

edge_cmapstr, optional

The matplotlib colormap to use for edge weights. Default is ‘Greys_r’.

edge_widthfloat, optional

The width of the edges. Default is 1.

edge_vminfloat, optional

The minimum value for edge colormap scaling. Default is None.

edge_vmaxfloat, optional

The maximum value for edge colormap scaling. Default is None.

add_cbarbool, optional

Whether to add a colorbar for the edge weights. Default is True.

axmatplotlib.axes.Axes, optional

The axes on which to draw the network. If None, a new figure and axes are created.

visualise_kwargsoptional

Additional keyword arguments to pass to the visualise function.

Returns:
figmatplotlib.figure.Figure

The figure object.

axmatplotlib.axes.Axes

The axis object.

Raises:
RuntimeError

If the specified network name is not found in the domain.

Notes

This function visualises a network using NetworkX and Matplotlib, with optional edge weight coloring and a colorbar.