Why Plots.spy directive does not show `one values`?

I am plotting the sparsity of matrix A by using Plots.spy, but the plot is not showing the ones values, e.g., A[13,4], A[14,5],A[15,6].

  • Can you guide me for the reason?
  • Is there a way also to show the non-zero elements in the bottom of the figure as in Matlab?
julia> using Plots
julia> A
15×15 SparseMatrixCSC{Float64, Int64} with 42 stored entries:
  0.0137346     ⋅            ⋅            ⋅     ⋅     ⋅     ⋅             ⋅             ⋅           -0.00123457     ⋅             ⋅            ⋅    ⋅    ⋅ 
   ⋅           0.0137346     ⋅            ⋅     ⋅     ⋅     ⋅             ⋅             ⋅             ⋅           -0.00123457     ⋅            ⋅    ⋅    ⋅ 
   ⋅            ⋅           0.0137346     ⋅     ⋅     ⋅     ⋅             ⋅             ⋅             ⋅             ⋅           -0.00123457    ⋅    ⋅    ⋅ 
   ⋅            ⋅            ⋅           1.0    ⋅     ⋅   -1.0            ⋅             ⋅             ⋅             ⋅             ⋅           1.0   ⋅    ⋅ 
   ⋅            ⋅            ⋅            ⋅    1.0    ⋅     ⋅           -1.0            ⋅             ⋅             ⋅             ⋅            ⋅   1.0   ⋅ 
   ⋅            ⋅            ⋅            ⋅     ⋅    1.0    ⋅             ⋅           -1.0            ⋅             ⋅             ⋅            ⋅    ⋅   1.0
   ⋅            ⋅            ⋅          -1.0    ⋅     ⋅    1.00302      -0.000705766  -0.000705766    ⋅             ⋅             ⋅            ⋅    ⋅    ⋅ 
   ⋅            ⋅            ⋅            ⋅   -1.0    ⋅   -0.000705766   1.00302      -0.000705766    ⋅             ⋅             ⋅            ⋅    ⋅    ⋅ 
   ⋅            ⋅            ⋅            ⋅     ⋅   -1.0  -0.000705766  -0.000705766   1.00302        ⋅             ⋅             ⋅            ⋅    ⋅    ⋅ 
 -0.00123457    ⋅            ⋅            ⋅     ⋅     ⋅     ⋅             ⋅             ⋅            0.00425693   -0.000705766  -0.000705766   ⋅    ⋅    ⋅ 
   ⋅          -0.00123457    ⋅            ⋅     ⋅     ⋅     ⋅             ⋅             ⋅           -0.000705766   0.00425693   -0.000705766   ⋅    ⋅    ⋅ 
   ⋅            ⋅          -0.00123457    ⋅     ⋅     ⋅     ⋅             ⋅             ⋅           -0.000705766  -0.000705766   0.00425693    ⋅    ⋅    ⋅ 
   ⋅            ⋅            ⋅           1.0    ⋅     ⋅     ⋅             ⋅             ⋅             ⋅             ⋅             ⋅            ⋅    ⋅    ⋅ 
   ⋅            ⋅            ⋅            ⋅    1.0    ⋅     ⋅             ⋅             ⋅             ⋅             ⋅             ⋅            ⋅    ⋅    ⋅ 
   ⋅            ⋅            ⋅            ⋅     ⋅    1.0    ⋅             ⋅             ⋅             ⋅             ⋅             ⋅            ⋅    ⋅    ⋅ 

spy(A)

Could this be just a color scheme related issue i.e. the 1 not being visible just because it’s a bright color against the white background?
Could you try

spy(A, markercolor = :darkrainbow)

and see if the 1s show up then?

Yes, it shown now. Thank you very much!

  • I want to make the points in dark color only, could you please guide me about the docmumenation to play with the arguments of spy?
  • Is there a way also to show the non-zero elements in the bottom of the figure as in Matlab?