implement heatmapr recipe
This commit is contained in:
parent
9acb89ba8a
commit
685e2eaff7
@ -389,6 +389,34 @@ end
|
||||
end
|
||||
@deps bar shape
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Heatmap
|
||||
@recipe function f(::Type{Val{:heatmapr}}, x, y, z)
|
||||
xe, ye = heatmap_edges(x), heatmap_edges(y)
|
||||
m, n = size(z.surf)
|
||||
x_pts, y_pts = fill(NaN, 6 * m * n), fill(NaN, 6 * m * n)
|
||||
fz = zeros(m * n)
|
||||
for i in 1:m # y
|
||||
for j in 1:n # x
|
||||
k = (j - 1) * m + i
|
||||
inds = (6 * (k - 1) + 1):(6 * k - 1)
|
||||
x_pts[inds] .= [xe[j], xe[j + 1], xe[j + 1], xe[j], xe[j]]
|
||||
y_pts[inds] .= [ye[i], ye[i], ye[i + 1], ye[i + 1], ye[i]]
|
||||
fz[k] = z.surf[i, j]
|
||||
end
|
||||
end
|
||||
ensure_gradient!(plotattributes, :fillcolor, :fillalpha)
|
||||
fill_z := fz
|
||||
linewidth := 0
|
||||
linecolor := invisible()
|
||||
x := x_pts
|
||||
y := y_pts
|
||||
z := nothing
|
||||
seriestype := :shape
|
||||
label := ""
|
||||
()
|
||||
end
|
||||
@deps heatmapr shape
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Histograms
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
const FuncOrFuncs{F} = Union{F, Vector{F}, Matrix{F}}
|
||||
|
||||
all3D(d::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image), get(d, :seriestype, :none))
|
||||
all3D(d::KW) = trueOrAllTrue(st -> st in (:contour, :contourf, :heatmap, :surface, :wireframe, :contour3d, :image, :heatmapr), get(d, :seriestype, :none))
|
||||
|
||||
# unknown
|
||||
convertToAnyVector(x, d::KW) = error("No user recipe defined for $(typeof(x))")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user