Merge pull request #886 from daschw/ds-spy
Changed spy recipe and added spy example to tests (fix #883)
This commit is contained in:
commit
3def6265c4
@ -319,6 +319,15 @@ PlotExample("Animation with subplots",
|
|||||||
end)]
|
end)]
|
||||||
),
|
),
|
||||||
|
|
||||||
|
PlotExample("Spy",
|
||||||
|
"For a matrix `mat` with unique nonzeros `spy(mat)` returns a colorless plot. If `mat` has various different nonzero values, a colorbar is added. The colorbar can be disabled with `legend = nothing`. As always, the marker shape and size can be changed with `spy(mat, markersize = 3, markershape = :star)`",
|
||||||
|
[:(begin
|
||||||
|
a = spdiagm((ones(50), ones(49), ones(49), ones(40), ones(40)),(0, 1, -1, 10, -10))
|
||||||
|
b = spdiagm((1:50, 1:49, 1:49, 1:40, 1:40),(0, 1, -1, 10, -10))
|
||||||
|
plot(spy(a, markershape = :dtriangle), spy(b), markersize = 3, title = ["Unique nonzeros" "Different nonzeros"])
|
||||||
|
end)]
|
||||||
|
),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -976,6 +976,9 @@ end
|
|||||||
@assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix
|
@assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix
|
||||||
seriestype := :spy
|
seriestype := :spy
|
||||||
mat = g.args[1]
|
mat = g.args[1]
|
||||||
|
if length(unique(mat[mat .!= 0])) < 2
|
||||||
|
legend --> nothing
|
||||||
|
end
|
||||||
n,m = size(mat)
|
n,m = size(mat)
|
||||||
Plots.SliceIt, 1:m, 1:n, Surface(mat)
|
Plots.SliceIt, 1:m, 1:n, Surface(mat)
|
||||||
end
|
end
|
||||||
@ -999,6 +1002,7 @@ end
|
|||||||
y := rs
|
y := rs
|
||||||
z := nothing
|
z := nothing
|
||||||
seriestype := :scatter
|
seriestype := :scatter
|
||||||
|
grid --> false
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user