DimensionalData.jl icon indicating copy to clipboard operation
DimensionalData.jl copied to clipboard

heatmap!(dimarray) fails

Open felixcremer opened this issue 2 years ago • 2 comments

This functionality would be nice to have for quick exploratory plots when I don't want to set up a figure or an axis.

julia>     A2ab = DimArray(rand(6, 10), (:a, :b); name=:stuff)
6×10 DimArray{Float64,2} stuff with dimensions: Dim{:a}, Dim{:b}
 0.32019   0.226085  0.37014   0.914092   …  0.140414   0.790857  0.575638
 0.778025  0.491312  0.941588  0.643231      0.898532   0.328257  0.657866
 0.539087  0.649716  0.211232  0.236093      0.24481    0.665561  0.427165
 0.201638  0.322929  0.699907  0.874531      0.586246   0.381726  0.848555
 0.729902  0.148025  0.965948  0.559869      0.0880131  0.733123  0.488596
 0.66537   0.202969  0.18232   0.0256769  …  0.117287   0.254833  0.355184

julia> heatmap(A2ab)

julia> heatmap!(A2ab)
ERROR: MethodError: plot!(::Type{Heatmap}, ::DimArray{Float64, 2, Tuple{Dim{:a, DimensionalData.Dimensions.LookupArrays.NoLookup{Base.OneTo{Int64}}}, Dim{:b, DimensionalData.Dimensions.LookupArrays.NoLookup{Base.OneTo{Int64}}}}, Tuple{}, Matrix{Float64}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata}) is ambiguous.

Candidates:
  plot!(axis, A::AbstractDimArray{<:Any, 2}; x, y, colorbarkw, attributes...)
    @ DimensionalDataMakie ~/.julia/packages/DimensionalData/STtQw/ext/DimensionalDataMakie.jl:153
  plot!(P::Union{Type{Any}, Type{<:AbstractPlot}}, args...; kw_attributes...)
    @ Makie ~/.julia/packages/Makie/NrrbP/src/figureplotting.jl:71

Possible fix, define
  plot!(::Union{Type{Any}, Type{<:AbstractPlot}}, ::AbstractDimArray{<:Any, 2})

Stacktrace:
 [1] heatmap!(args::DimArray{Float64, 2, Tuple{Dim{:a, DimensionalData.Dimensions.LookupArrays.NoLookup{Base.OneTo{Int64}}}, Dim{:b, DimensionalData.Dimensions.LookupArrays.NoLookup{Base.OneTo{Int64}}}}, Tuple{}, Matrix{Float64}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata}; attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ MakieCore ~/.julia/packages/MakieCore/7iPhv/src/recipes.jl:39
 [2] heatmap!(args::DimArray{Float64, 2, Tuple{Dim{:a, DimensionalData.Dimensions.LookupArrays.NoLookup{Base.OneTo{Int64}}}, Dim{:b, DimensionalData.Dimensions.LookupArrays.NoLookup{Base.OneTo{Int64}}}}, Tuple{}, Matrix{Float64}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata})
   @ MakieCore ~/.julia/packages/MakieCore/7iPhv/src/recipes.jl:38
 [3] top-level scope
   @ REPL[17]:1

felixcremer avatar Oct 31 '23 22:10 felixcremer

Toyally, want to add it?

rafaqz avatar Nov 01 '23 01:11 rafaqz

I can have a look next week.

felixcremer avatar Nov 01 '23 08:11 felixcremer