Skip to content
import marimo as mo

Matrix Plot

Here is an example of how to create a matrix plot.

# magic command not supported in marimo; please file an issue to add support
# %config InlineBackend.figure_format = 'retina'
# magic command not supported in marimo; please file an issue to add support
# %load_ext autoreload
# '%autoreload 2' command supported automatically in marimo
import networkx as nx

import nxviz as nv
G = nx.lollipop_graph(m=10, n=4)
for n, d in G.nodes(data=True):
    G.nodes[n]["degree"] = nx.degree(G, n)
ax = nv.matrix(G, sort_by="degree", node_color_by="degree")
nx.draw(G)