Skip to content

spy

sparse · scripts/sparse/spy.m

spy (S)
spy (S, LineSpec)
spy (S, markersize)
spy (S, LineSpec, markersize)
spy (S, markersize, LineSpec)

Plot the sparsity pattern of S: one marker per nonzero at (column, row),
with row 1 at the top.  The x label is "nz = N" (N = nnz(S)), matching
MATLAB R2026a.  The default marker is a dot whose MarkerSize shrinks with
matrix order (14 down to 4); any other marker uses the figure default
line MarkerSize (typically 6).  Markersize may be given before or after
LineSpec.  A markersize of 0 means "use the default".  No outputs (MATLAB
R2026a raises MATLAB:TooManyOutputs if one is requested).

Decision (nexus#1968): spy() with no matrix argument is documented as
requiring S.  MATLAB's undocumented defaultspy logo pattern is not
reproduced; zero inputs raise MATLAB:narginchk:notEnoughInputs.