spy recipes
This commit is contained in:
parent
9bbe0f9414
commit
5e8c88d657
@ -742,6 +742,43 @@ end
|
||||
# kw...)
|
||||
# end
|
||||
|
||||
# Only allow matrices through, and make it seriestype :spy so the backend can
|
||||
# optionally handle it natively.
|
||||
|
||||
@userplot Spy
|
||||
|
||||
@recipe function f(g::Spy)
|
||||
@assert length(g.args) == 1 && typeof(g.args[1]) <: AbstractMatrix
|
||||
seriestype := :spy
|
||||
mat = g.args[1]
|
||||
n,m = size(mat)
|
||||
Plots.SliceIt, 1:m, 1:n, Surface(mat)
|
||||
end
|
||||
|
||||
@recipe function f(::Type{Val{:spy}}, x,y,z)
|
||||
yflip := true
|
||||
aspect_ratio := 1
|
||||
rs, cs, zs = findnz(z.surf)
|
||||
xlim := extrema(cs)
|
||||
ylim := extrema(rs)
|
||||
if d[:markershape] == :none
|
||||
markershape := :circle
|
||||
end
|
||||
if d[:markersize] == default(:markersize)
|
||||
markersize := 1
|
||||
end
|
||||
markerstrokewidth := 0
|
||||
marker_z := zs
|
||||
label := ""
|
||||
x := cs
|
||||
y := rs
|
||||
z := nothing
|
||||
seriestype := :scatter
|
||||
()
|
||||
end
|
||||
|
||||
# -------------------------------------------------
|
||||
|
||||
"Adds a+bx... straight line over the current plot"
|
||||
function abline!(plt::Plot, a, b; kw...)
|
||||
plot!(plt, [extrema(plt)...], x -> b + a*x; kw...)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user