Skip to content

spy

Sparsity-pattern plot of a sparse matrix.

h = spy(s, c, sp)

Plots non-zero entries of s as markers on a 2D grid. Useful for visualizing sparse-matrix structure (banded, block-diagonal, fill-in, etc.).

spy(sparse(magic(50)))
  • sparse — Create a sparse matrix.
  • scatter — 2D scatter plot with optional size and color encoding.