changed spy plot example
This commit is contained in:
parent
ee23cb2185
commit
1a07c39fad
@ -319,12 +319,11 @@ PlotExample("Animation with subplots",
|
|||||||
),
|
),
|
||||||
|
|
||||||
PlotExample("Spy",
|
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 = 5, markershape = :diamond)`",
|
"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
|
[:(begin
|
||||||
a = spdiagm((ones(200), ones(199), ones(199), ones(150), ones(150)),(0, 1, -1, 50, -50))
|
a = spdiagm((ones(50), ones(49), ones(49), ones(40), ones(40)),(0, 1, -1, 10, -10))
|
||||||
n = 20
|
b = spdiagm((1:50, 1:49, 1:49, 1:40, 1:40),(0, 1, -1, 10, -10))
|
||||||
b = [i > j ? i * j : 0 for i in 1:n, j in 1:n]
|
plot(spy(a, markershape = :star), spy(b), markersize = 3, title = ["Unique nonzeros" "Different nonzeros"])
|
||||||
plot(spy(a), spy(b, markersize = 5, markershape = :diamond), title = ["Unique nonzeros" "Different nonzeros"], yguide = "Row", xguide = "Column")
|
|
||||||
end)]
|
end)]
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@ -976,7 +976,7 @@ 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)) <= 2
|
if length(unique(mat[mat .!= 0])) < 2
|
||||||
legend --> nothing
|
legend --> nothing
|
||||||
end
|
end
|
||||||
n,m = size(mat)
|
n,m = size(mat)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user