metachat.pl.plot_graph_connectivity
- metachat.pl.plot_graph_connectivity(G, node_size=10.0, linewidths=1.0, width=1.0, show_weights=False, weight_fontsize=8, figsize=(8, 8), plot_savepath=None)[source]
Plot a 2D visualization of a graph showing connectivity between nodes and edges.
This function visualizes a graph structure (e.g., communication connectivity or spatial relationships) using node coordinates as (x, y) positions. Optionally, edge weights can be displayed as labels.
Parameters
- Gnetworkx.Graph
Input graph where each node represents a 2D point (tuple of x, y coordinates) and edges may have an optional
'weight'attribute.- node_sizefloat, default=10.0
Marker size of nodes.
- linewidthsfloat, default=1.0
Line width of node borders.
- widthfloat, default=1.0
Width of edges.
- show_weightsbool, default=False
Whether to display numerical edge weights on the plot.
- weight_fontsizeint, default=8
Font size of edge weight annotations (effective only if
show_weights=True).- figsizetuple of float, default=(8, 8)
Figure size (width, height) in inches.
- plot_savepathstr, optional
File path to save the figure (e.g.,
"results/graph_connectivity.png"). IfNone, the figure is shown interactively.
Returns
- axmatplotlib.axes.Axes
Matplotlib axis containing the rendered graph.
Notes
Node coordinates are assumed to be stored as the node keys, e.g.
(x, y)tuples.Edge weights (if any) are visualized with labels when
show_weights=True.Commonly used for inspecting graph connectivity matrices derived from spatial MCC data.