grid --> false in spy recipe, removed info, added example

This commit is contained in:
Daniel Schwabeneder 2017-06-03 01:14:25 +02:00
parent 3d3ec2a194
commit ee23cb2185
2 changed files with 14 additions and 1 deletions

View File

@ -318,6 +318,16 @@ PlotExample("Animation with subplots",
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 = 5, markershape = :diamond)`",
[:(begin
a = spdiagm((ones(200), ones(199), ones(199), ones(150), ones(150)),(0, 1, -1, 50, -50))
n = 20
b = [i > j ? i * j : 0 for i in 1:n, j in 1:n]
plot(spy(a), spy(b, markersize = 5, markershape = :diamond), title = ["Unique nonzeros" "Different nonzeros"], yguide = "Row", xguide = "Column")
end)]
),
]
# ---------------------------------------------------------------------------------

View File

@ -976,6 +976,9 @@ end
@assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix
seriestype := :spy
mat = g.args[1]
if length(unique(mat)) <= 2
legend --> nothing
end
n,m = size(mat)
Plots.SliceIt, 1:m, 1:n, Surface(mat)
end
@ -990,7 +993,6 @@ end
markershape := :circle
end
if d[:markersize] == default(:markersize)
info("In the spy recipe the default markersize is 1. If you are viewing a small matrix, you may consider increasing it with the markersize attribute.")
markersize := 1
end
markerstrokewidth := 0
@ -1000,6 +1002,7 @@ end
y := rs
z := nothing
seriestype := :scatter
grid --> false
()
end