visualise_network#
- visualise_network(domain, network_name=None, edge_weight_name=None, 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
visualisefunction frommuspan.visualise. To modify the visualisation of the objects, you can pass additional keyword arguments to thevisualisefunction 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 ‘Distance’ to visualise the weighted network. Default is None.
- 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
visualisefunction.
- 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.