Skip to content

Commit

Permalink
Merge pull request #26 from jw3126/plots
Browse files Browse the repository at this point in the history
add more plot recipes
  • Loading branch information
rafaqz authored Dec 19, 2019
2 parents bde0bad + 9e0838d commit 443132f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/plotrecipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 443132f

Please sign in to comment.