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

**URL:** <https://discourse.julialang.org/t/why-plots-spy-directive-does-not-show-one-values/88168>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 3, 2022, 4:37pm UTC](https://discourse.julialang.org/t/why-plots-spy-directive-does-not-show-one-values/88168 "2022-10-03T16:37:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [October 3, 2022, 4:37pm UTC](https://discourse.julialang.org/t/why-plots-spy-directive-does-not-show-one-values/88168/1 "2022-10-03T16:37:09Z")

</div>

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
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)

```

 ![ddd](https://global.discourse-cdn.com/julialang/original/3X/2/b/2b7c67f25fdba3081654b73e915035019a8303a5.png)

---

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [October 3, 2022, 7:28pm UTC](https://discourse.julialang.org/t/why-plots-spy-directive-does-not-show-one-values/88168/2 "2022-10-03T19:28:05Z")

</div>

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

```julia
spy(A, markercolor = :darkrainbow)

```

and see if the `1`s show up then?

---

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [October 3, 2022, 7:35pm UTC](https://discourse.julialang.org/t/why-plots-spy-directive-does-not-show-one-values/88168/3 "2022-10-03T19:35:22Z")

</div>

> [@digital\_carver](#):
>
> and see if the `1`s 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?
