Merge pull request #1704 from mkborregaard/old_spy
Reinstate scatter-based spy implementation; fix #1682
This commit is contained in:
commit
bad5668ff7
@ -1024,10 +1024,6 @@ 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
|
|
||||||
seriescolor --> cgrad([invisible(), fg_color(plotattributes)])
|
|
||||||
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
|
||||||
@ -1035,21 +1031,23 @@ end
|
|||||||
@recipe function f(::Type{Val{:spy}}, x,y,z)
|
@recipe function f(::Type{Val{:spy}}, x,y,z)
|
||||||
yflip := true
|
yflip := true
|
||||||
aspect_ratio := 1
|
aspect_ratio := 1
|
||||||
|
|
||||||
rs, cs, zs = findnz(z.surf)
|
rs, cs, zs = findnz(z.surf)
|
||||||
newz = fill(NaN, size(z)...)
|
xlim := ignorenan_extrema(cs)
|
||||||
|
ylim := ignorenan_extrema(rs)
|
||||||
for i in eachindex(zs)
|
if plotattributes[:markershape] == :none
|
||||||
newz[rs[i],cs[i]] = zs[i]
|
markershape := :circle
|
||||||
end
|
end
|
||||||
|
if plotattributes[:markersize] == default(:markersize)
|
||||||
seriestype := :heatmap
|
markersize := 1
|
||||||
|
end
|
||||||
|
markerstrokewidth := 0
|
||||||
|
marker_z := zs
|
||||||
|
label := ""
|
||||||
|
x := cs
|
||||||
|
y := rs
|
||||||
|
z := nothing
|
||||||
|
seriestype := :scatter
|
||||||
grid --> false
|
grid --> false
|
||||||
framestyle --> :box
|
|
||||||
|
|
||||||
x := x
|
|
||||||
y := y
|
|
||||||
z := Surface(newz)
|
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user