Back to Data Visualization
spy
Visualize sparsity pattern
Syntax
spy(S) spy(S, linespec) spy(S, markersize)
Description
Generates a graphical representation of the sparsity pattern of a matrix S. Nonzero values are displayed as markers at their (column, row) positions. The x-axis label shows "nz = N" where N is the number of nonzero elements.
Parameters
| Name | Description |
|---|---|
| S | Input matrix (sparse or full) |
| linespec(optional) | Line specification for marker style (e.g., 'ro' for red circles) |
| markersize(optional) | Marker size in points (default: auto-scaled based on matrix size) |
Returns
null (renders chart inline)