spy

spy(x::Range, y::Range, z::AbstractSparseArray)

Visualizes big sparse matrices. Usage:

N = 200_000
x = sprand(Float64, N, N, (3(10^6)) / (N*N));
spy(x)
# or if you want to specify the range of x and y:
spy(0..1, 0..1, x)

Attributes

Available attributes and their defaults for Plot{Makie.spy} are:

  colormap     :viridis
  colorrange   MakieCore.Automatic()
  colorscale   identity
  framecolor   :black
  framesize    1
  inspectable  true
  marker       MakieCore.Automatic()
  markersize   MakieCore.Automatic()
  visible      true

Examples

using CairoMakie, SparseArrays


N = 100 # dimension of the sparse matrix
p = 0.1 # independent probability that an entry is zero

A = sprand(N, N, p)

f, ax, plt = spy(A, markersize = 4, marker = :circle, framecolor = :lightgrey)

hidedecorations!(ax) # remove axis labeling
ax.title = "Visualization of a random sparse matrix"

f