Note
Go to the end to download the full example code.
Spy

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.
View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.
View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.
import numpy as np
import plotpress
rng = np.random.default_rng(1)
A = np.zeros((30, 30))
A[rng.random((30, 30)) > 0.9] = 1.0 # ~10% nonzero
np.fill_diagonal(A, 1.0)
fig, ax = plotpress.subplots()
ax.spy(A)
ax.set_title("spy (sparsity pattern)")
Total running time of the script: (0 minutes 0.081 seconds)