From 9e0838dcc3bea0118ba0d3a2dd4e99de29d7f2ed Mon Sep 17 00:00:00 2001 From: Jan Weidner Date: Thu, 19 Dec 2019 02:55:11 -0800 Subject: [PATCH] add more plot recipes --- src/plotrecipes.jl | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/plotrecipes.jl b/src/plotrecipes.jl index 27ac83255..4cd3f401c 100644 --- a/src/plotrecipes.jl +++ b/src/plotrecipes.jl @@ -17,3 +17,25 @@ end title --> label(refdims(ga)) val(dims(ga)[1]), parent(ga) end + +struct HeatMapLike end +@recipe function f(ga::AbstractDimensionalArray{<:Any,2}) + sertyp = get(plotattributes, :seriestype, nothing) + if sertyp in [:heatmap, :contour, :surface, :wireframe] + ga, HeatMapLike() + else + parent(ga) + end +end + +@recipe function f(ga::AbstractDimensionalArray, ::HeatMapLike) + @assert ndims(ga) == 2 + dim1, dim2 = dims(ga) + # Notice that dim1 corresponds to Y + # and dim2 corresponds to X + # This is because in Plots.jl + # The first axis of a matrix is the Y axis + :ylabel --> label(dim1) + :xlabel --> label(dim2) + val(dim2), val(dim1), parent(ga) +end