diff --git a/src/recipes.jl b/src/recipes.jl index 099d9b38..3ece3f9c 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -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 diff --git a/src/series.jl b/src/series.jl index 1a502cc5..4c8607fd 100644 --- a/src/series.jl +++ b/src/series.jl @@ -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))")