Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makie recipes #528

Merged
merged 22 commits into from
Sep 14, 2023
Merged

Add Makie recipes #528

merged 22 commits into from
Sep 14, 2023

Conversation

rafaqz
Copy link
Owner

@rafaqz rafaqz commented Aug 30, 2023

Adds a Makie.jl extension and support for most plot types with axis labels and ticks.

Seems a clean way to generate Makie plots with very little code:

heatmap(rand(Ti('a':'z'), Y(10)))
lines(rand(X(0.1:0.1:1.0); name="values"))
boxplot(rand(X(1:10), Y([:a, :b, :c])))

@lazarusA maybe you have some ideas for all the things I have missed?

@tomchor this also implements your dims=:a => X request for 2d and 3d plots.

Closes #524, closes #528 and closes #275

Also @JoshuaBillson this may be of interest with RemoteSensingToolbox for your Makie.jl recipes, and @asinghvi17 as you got all this started! I think most of Rasters.jl Makie recipes could move here so everyone can use it?

@lazarusA
Copy link
Collaborator

lazarusA commented Sep 3, 2023

wow! this is so great. I will take a good look. Now, a lot my current code in YAXAarrays will be duplicated, but this is definitely cleaner 😄

@tomchor
Copy link

tomchor commented Sep 3, 2023

@rafaqz this is looking great!

@tomchor this also implements your dims=:a => X request for 2d and 3d plots.

Nice! ❤️

Let me know when this is ready for testing and I'll try some of my code on this branch.

@rafaqz rafaqz marked this pull request as ready for review September 3, 2023 16:58
@rafaqz
Copy link
Owner Author

rafaqz commented Sep 10, 2023

@lazarusA and @tomchor if you want to try these out we may as well merge soon

@tomchor
Copy link

tomchor commented Sep 11, 2023

@lazarusA and @tomchor if you want to try these out we may as well merge soon

I'm getting an error like

ERROR: LoadError: Error in conversion pipeline. xs and ys should have size ni+1, nj+1. Found: xs: 85, ys: 256, ni: 85, nj: 256
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] draw_atomic(scene::Scene, screen::CairoMakie.Screen{CairoMakie.IMAGE}, primitive::Union{Image, Heatmap})
    @ CairoMakie /glade/work/tomasc/.julia/packages/CairoMakie/58F4c/src/primitives.jl:671
  [3] draw_plot(scene::Scene, screen::CairoMakie.Screen{CairoMakie.IMAGE}, primitive::Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{Float32}}})
  [4] cairo_draw(screen::CairoMakie.Screen{CairoMakie.IMAGE}, scene::Scene)
    @ CairoMakie /glade/work/tomasc/.julia/packages/CairoMakie/58F4c/src/infrastructure.jl:51
  [5] colorbuffer(screen::CairoMakie.Screen{CairoMakie.IMAGE})
    @ CairoMakie /glade/work/tomasc/.julia/packages/CairoMakie/58F4c/src/screen.jl:307
  [6] colorbuffer(screen::CairoMakie.Screen{CairoMakie.IMAGE}, format::Makie.ImageStorageFormat)
    @ Makie /glade/work/tomasc/.julia/packages/Makie/Xg6gx/src/display.jl:363
  [7] recordframe!(io::VideoStream)
    @ Makie /glade/work/tomasc/.julia/packages/Makie/Xg6gx/src/ffmpeg-util.jl:242
  [8] Record(func::var"#33#34", figlike::Figure, iter::StepRange{Int64, Int64}; kw_args::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:format, :framerate), Tuple{SubString{String}, Int64}}})
    @ Makie /glade/work/tomasc/.julia/packages/Makie/Xg6gx/src/recording.jl:168
  [9] record(func::Function, figlike::Figure, path::String, iter::StepRange{Int64, Int64}; kw_args::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:framerate,), Tuple{Int64}}})
    @ Makie /glade/work/tomasc/.julia/packages/Makie/Xg6gx/src/recording.jl:148
 [10] top-level scope
    @ /glade/scratch/tomasc/twake3/headland_simulations/plot_headland_video.jl:217

but tbh I haven't been able to pinpoint it to this change since I hadn't updated DD/Rasters/Makie in a little while (due to issues like rafaqz/Rasters.jl#492).

Can you please exemplify how to plot DimArrays with non-default (i.e. not X, Y Z) dimension names? Did you end up going with Makie.heatmap(raster; dims=(X=:fX, Y=:fY))?

I it turns out this branch is the source of the error I'll make a MWE asap.

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 12, 2023

Ok there was a small bug in this, so checkout the branch again (its also been rebased sorry)

But this example should work:

A = DimArray(rand(10, 10), (:a, :b))
Makie.heatmap(A; dims=(:a => X, :b => Y))

It ended up making more sense to use Pairs than a namedtuple.

(this is in the heatmap etc docstings too, see if they make sense)

@tomchor
Copy link

tomchor commented Sep 13, 2023

I haven't tested my full plots, but a simple example revals:

julia> using DimensionalData, GLMakie

julia> A = DimArray(rand(4, 4), (:a, :b))
4×4 DimArray{Float64,2} with dimensions: Dim{:a}, Dim{:b}
 0.170095  0.938657  0.362559  0.275481
 0.273901  0.689077  0.618861  0.920637
 0.863314  0.834279  0.343351  0.196132
 0.645745  0.468384  0.66314   0.0274788

julia> heatmap(A) # Plots things appropriately

julia> heatmap(A, dims=(:b => :X))
ERROR: ArgumentError: Some dims were not found in object.
Stacktrace:
  [1] _extradimserror()
    @ DimensionalData.Dimensions ~/.julia/packages/DimensionalData/QypyH/src/Dimensions/primitives.jl:744
  [2] dimnum
    @ ~/.julia/packages/DimensionalData/QypyH/src/Dimensions/primitives.jl:204 [inlined]
  [3] permutedims
    @ ~/.julia/packages/DimensionalData/QypyH/src/array/methods.jl:205 [inlined]
  [4] _permute_xyz(A::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}, DimensionalData.NoName, DimensionalData.Dimensions.LookupArrays.NoMetadata}, replacements::Tuple{Dim{:b, X{Colon}}})
    @ DimensionalDataMakie ~/.julia/packages/DimensionalData/QypyH/ext/DimensionalDataMakie.jl:412
  [5] _permute_xyz(A::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}, DimensionalData.NoName, DimensionalData.Dimensions.LookupArrays.NoMetadata}, replacements::Tuple{Pair{Symbol, Symbol}})
    @ DimensionalDataMakie ~/.julia/packages/DimensionalData/QypyH/ext/DimensionalDataMakie.jl:405
  [6] _permute_xyz
    @ ~/.julia/packages/DimensionalData/QypyH/ext/DimensionalDataMakie.jl:404 [inlined]
  [7] _prepare_for_makie(A::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}, DimensionalData.NoName, DimensionalData.Dimensions.LookupArrays.NoMetadata}, replacements::Pair{Symbol, Symbol})
    @ DimensionalDataMakie ~/.julia/packages/DimensionalData/QypyH/ext/DimensionalDataMakie.jl:401
  [8] _surface2(A::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}, DimensionalData.NoName, DimensionalData.Dimensions.LookupArrays.NoMetadata}, attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, dims::Pair{Symbol, Symbol})
    @ DimensionalDataMakie ~/.julia/packages/DimensionalData/QypyH/ext/DimensionalDataMakie.jl:150
  [9] heatmap(A::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}, DimensionalData.NoName, DimensionalData.Dimensions.LookupArrays.NoMetadata}; dims::Pair{Symbol, Symbol}, colorbarkw::NamedTuple{(), Tuple{}}, attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ DimensionalDataMakie ~/.julia/packages/DimensionalData/QypyH/ext/DimensionalDataMakie.jl:130
 [10] top-level scope
    @ REPL[23]:1

I'd expect the previous command to work, since you can infer that :a => :Y just by elimination. In fact that's the example given in the current docstring:

_dims_doc(f) = """
- `dims`: A `Pair` or Tuple of Pair of `Dimension` or `Symbol`. Can be used to
specify dimensions that should be moved to the `X`, `Y` and `Z` dimensions
of the plot. For example `$f(A, dims=:a => :X)` will use the `:a` dimension
as the `X` dimension in the plot.

Instead I have to manually write out both axes for this to work: heatmap(A, dims=(:b => :X, :a => :Y)). Is this by design?

@tomchor
Copy link

tomchor commented Sep 13, 2023

Another comment is that I've thought about it, and it still seems much simpler to me to take advantage of the notation already used by Makie (i.e. the method heatmap(x, y, values)) and make the UI something like:

heatmap(A, x=:b, y=:a)

instead of the current

heatmap(A, dims=(:b => :X, :a => :Y))

For me the main selling points are that it's shorter to write and it's more intuitive to Makie users since it an interface that's much closer to Makie's. (The same goes for the Plots interface.) It probably would make it easier to find the appropriate methods to since a quick call to methods(heatmap) would list the appropriate x and y keywords, instead of dims (which a user would need to read the docstring attentively to learn how to use).

Is there a specific reason why a dims kwarg was used instead of x and y?

Comment on lines 23 to 24
- `dims`: A `Pair` or Tuple of Pair of `Dimension` or `Symbol`. Can be used to
specify dimensions that should be moved to the `X`, `Y` and `Z` dimensions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One downside of using this same docstring for all methods is that, for example, the Z dimension doesn't exist in heatmaps and will throw an error if the user tries to use it.

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Instead I have to manually write out both axes for this to work: heatmap(A, dims=(:b => :X, :a => :Y)). Is this by design?

No, it must have broken. I've just tested this:

julia> heatmap(A; dims=(:b => Y))

Which somehow works.

I don't have actual tests for this because Makie will kill our CI. But I might add a proper test suit to run locally to try to get more edge cases.

Is there a specific reason why a dims kwarg was used instead of x and y?

Bad syntax doesn't need a reason, its the natural state of code 😅

But seriously my main reason not to use keywords like that is your example:

heatmap(x, y, values)

x and y are already argument names used in Makie documentation and having them as keywords seems a bit weird.
But you may be right, it is a nice symetry - they specify which dimension lookups end up as those arguments.

dims looks more like a DimensionalData.jl thing. But youre right, the syntax sucks, and if you just want to specify one of the keywords:

heatmap(A, x=:a)

is pretty concise.

I 'll switch to x/y/z keywords, thanks for the feedback

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Ok the bug is fixed and this should work:

heatmap(A; x=:a)

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Ok here's a little test suit of the current state of things:

    using GLMakie, DimensionalData
    # 1d
    A1 = rand(X('a':'e'); name=:test)
    plot(A1)
    scatter(A1)
    lines(A1)
    scatterlines(A1)
    stairs(A1)
    stem(A1)
    barplot(A1)
    waterfall(A1)
    # 2d
    A2 = rand(X(10:10:100), Y(['a', 'b', 'c']))
    A2r = rand(Y(10:10:100), X(['a', 'b', 'c']))
    plot(A2)
    # Categorical wins: it's on x, even though its Y
    boxplot(A2)
    boxplot(A2r)
    violin(A2)
    rainclouds(A2)
    # Series also puts Categories in the legend no matter where they are
    series(A2)
    series(A2r)
    # x/y can be specified
    A2 = DimArray(rand(10, 10), (:a, :b); name=:stuff)
    plot(A2)
    contourf(A2; x=:a)
    heatmap(A2; y=:b)
    @test_throws ArgumentError plot(A2; y=:c)
    # 3d
    A3 = rand(X(7), Z(10), Y(5))
    volume(A3)
    A3 = DimArray(rand(10, 10, 5), (:a, :b, :c); name=:stuff)
    volume(A3)
    volumeslices(A3)
    # x/y/z can be specified
    A2 = DimArray(rand(10, 10, 7), (:a, :b, :c); name=:stuff)
    volume(A3; x=:c)
    volumeslices(A3; z=:a)

@lazarusA would be good to get feedback from you on these too

@lazarusA
Copy link
Collaborator

all of your previous tests work for me as well. And at the moment, I don't have other use cases that might be useful.

@lazarusA
Copy link
Collaborator

I would expect also this one to work (which is not currently):

dd = DimArray(rand(m,n), (:a,:b))
series(dd)

where the color will need to be color= resample_cmap(:colormap, m). Probably the same should be done for your current implementation.

@lazarusA
Copy link
Collaborator

and maybe similarly,

A2 = rand(X(10:10:100), Y(['a', 'b', 'c']))
A2

surface(A2)

note: I know too many use cases. We should add more in following PRs. Otherwise this could go on forever.

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Ok surface and series work now, keep em coming

    using GLMakie
    # 1d
    A1 = rand(X('a':'e'); name=:test)
    plot(A1)
    scatter(A1)
    lines(A1)
    scatterlines(A1)
    stairs(A1)
    stem(A1)
    barplot(A1)
    waterfall(A1)
    # 2d
    A2 = rand(X(10:20:100), Y(['a', 'b', 'c']))
    A2r = rand(Y(10:20:100), X(['a', 'b', 'c']))
    plot(A2)
    # Categorical wins: it's on x, even though its Y
    boxplot(A2)
    boxplot(A2r)
    violin(A2)
    rainclouds(A2)
    surface(A2)
    # Series also puts Categories in the legend no matter where they are
    series(A2)
    series(A2r)
    series(A2r; labeldim=Y)
    @test_throws ArgumentError plot(A2; y=:c)
    # x/y can be specified
    A2ab = DimArray(rand(5, 6), (:a, :b); name=:stuff)
    plot(A2ab)
    contourf(A2ab; x=:a)
    heatmap(A2ab; y=:b)
    series(A2ab)
    boxplot(A2ab)
    violin(A2ab)
    rainclouds(A2ab)
    surface(A2ab)
    series(A2ab)
    series(A2ab; labeldim=:b)
    # 3d
    A3 = rand(X(7), Z(10), Y(5))
    volume(A3)
    volumeslices(A3)
    # x/y/z can be specified
    A3abc = DimArray(rand(10, 10, 7), (:a, :b, :c); name=:stuff)
    volume(A3abc; x=:c)
    volumeslices(A3; z=:a)

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Hmm forgot the series colors. Whats the default colormap for series? It would be good if it worked as much as possible like Makie by default. (And why doesn't makie do the resampling automatically?)

@lazarusA
Copy link
Collaborator

lazarusA commented Sep 13, 2023

it's something like :Set1_5 or something.... and no idea about the resampling, I always do it manually. The issue here is that there are too many options. Is a mix of lines and scatters.

@rafaqz you should resample the default theme's colormap for this, IMO.

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Ok above 7 series its now resampling the default :Set1_5 theme

@lazarusA
Copy link
Collaborator

lazarusA commented Sep 13, 2023

nice, I tested again, it works. I don't have more feedback at the moment. You maybe should merge. And any issues should be addressed on different PRs :D

@lazarusA
Copy link
Collaborator

ok. Well, maybe some last one. Just when things are under a million points, maybe.

a = YAXArray(rand(3,3,3)) |> DimArray
meshscatter(a; markersize=0.1)

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

You shouldn't need to convert to DimArray, YAXArray should plot now too ;)

@lazarusA
Copy link
Collaborator

δx = 1
δy = 1
δz = 1
pnts3d = [Point3f(i,j,k) for i in 1:3 for j in 1:3 for k in 1:3]

meshscatter(pnts3d; markersize=Vec3f(δx/2, δy/2, δz/2))

meshscatter(pnts3d;
    markersize= Vec3f(0.9δx, 0.9δy, 0.9δz),
    marker = Rect3f(Vec3f(-0.5), Vec3f(1))
    )

meshscatter(pnts3d;
    markersize= Vec3f(0.5δx, 0.5δy, 0.5δz),
    #marker = Sphere(Point3f(0), 1)
    )

this one is just a convenient function to plot data cubes. Which might be helpful to have.

@lazarusA
Copy link
Collaborator

You shouldn't need to convert to DimArray, YAXArray should plot now too ;)

Not really, for all cases I get errors like this one: (maybe more a yax issue ?)

using GLMakie, DimensionalData
using YAXArrays

a = YAXArray(rand(3,3)) #|> DimArray
heatmap(a)
ERROR: MethodError: no method matching getindex(::Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}, ::X{Colon})

Closest candidates are:
  getindex(::Tuple, ::Int64)
   @ Base tuple.jl:29
  getindex(::Tuple, ::Integer)
   @ Base tuple.jl:30
  getindex(::Tuple, ::Colon)
   @ Base tuple.jl:33
  ...

Stacktrace:
 [1] getindex
   @ ./tuple.jl:31 [inlined]
 [2] permutedims(c::YAXArray{Float64, 2, Matrix{Float64}, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}}, p::Tuple{X{Colon}, Y{Colon}})
   @ YAXArrays.Cubes ~/.julia/packages/YAXArrays/X0zci/src/Cubes/Cubes.jl:176
 [3] _permute_xyz(A::YAXArray{Float64, 2, Matrix{Float64}, Tuple{Dim{:Dim_1, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Dim{:Dim_2, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}}, replacements::Tuple{})
   @ DimensionalDataMakie ~/Desktop/tmp/DimensionalData.jl/ext/DimensionalDataMakie.jl:442
 [4] _prepare_for_makie(A::YAXArray{Float64, 2, Matrix{Float64}, Tuple{Dim{:Dim_1, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Dim{:Dim_2, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}}, replacements::Tuple{})
   @ DimensionalDataMakie ~/Desktop/tmp/DimensionalData.jl/ext/DimensionalDataMakie.jl:431
 [5] _surface2(A::YAXArray{Float64, 2, Matrix{Float64}, Tuple{Dim{:Dim_1, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Dim{:Dim_2, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}}, attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, replacements::Tuple{})
   @ DimensionalDataMakie ~/Desktop/tmp/DimensionalData.jl/ext/DimensionalDataMakie.jl:165
 [6] heatmap(A::YAXArray{Float64, 2, Matrix{Float64}, Tuple{Dim{:Dim_1, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Dim{:Dim_2, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}}; x::Nothing, y::Nothing, colorbarkw::NamedTuple{(), Tuple{}}, attributes::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ DimensionalDataMakie ~/Desktop/tmp/DimensionalData.jl/ext/DimensionalDataMakie.jl:134
 [7] heatmap(A::YAXArray{Float64, 2, Matrix{Float64}, Tuple{Dim{:Dim_1, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Dim{:Dim_2, DimensionalData.Dimensions.LookupArrays.Sampled{Int64, Base.OneTo{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}})
   @ DimensionalDataMakie ~/Desktop/tmp/DimensionalData.jl/ext/DimensionalDataMakie.jl:130
 [8] top-level scope
   @ ~/Desktop/tmp/DD_test/test_yax.jl:5

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

Ahhh YAXArrays has a bad permutedims, it needs to copy the dispatch from DD if its adding methods.

(so it can detect the dimensions)

@lazarusA
Copy link
Collaborator

lazarusA commented Sep 13, 2023

Ahhh YAXArrays has a bad permutedims, it needs to copy the dispatch from DD if its adding methods.

(so it can detect the dimensions)

this reads like a job for @felixcremer . I don't know where to start looking at. And for tonight, I'm off.

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 13, 2023

No worries, tried the meshscatter but its a bit weird converting a dimension to points, I'm also out for the day

(So maybe I'll merge without meshscatter, but we should keep adding things to this later as you say)

@codecov-commenter
Copy link

Codecov Report

Merging #528 (54e6ee1) into main (31d22ad) will decrease coverage by 6.91%.
Report is 6 commits behind head on main.
The diff coverage is 36.13%.

@@            Coverage Diff             @@
##             main     #528      +/-   ##
==========================================
- Coverage   89.68%   82.78%   -6.91%     
==========================================
  Files          39       40       +1     
  Lines        2909     3223     +314     
==========================================
+ Hits         2609     2668      +59     
- Misses        300      555     +255     
Files Changed Coverage Δ
ext/DimensionalDataMakie.jl 0.00% <0.00%> (ø)
src/Dimensions/set.jl 92.00% <0.00%> (-3.84%) ⬇️
src/Dimensions/primitives.jl 85.96% <62.82%> (-8.01%) ⬇️
src/array/methods.jl 87.50% <77.87%> (-7.31%) ⬇️
src/Dimensions/indexing.jl 93.93% <100.00%> (ø)
src/plotrecipes.jl 82.57% <100.00%> (ø)
src/precompile.jl 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rafaqz rafaqz merged commit f9e45af into main Sep 14, 2023
9 checks passed
@rafaqz rafaqz deleted the makie branch September 14, 2023 16:42
@tomchor
Copy link

tomchor commented Sep 17, 2023

@rafaqz sorry I've been offline for a while so I didn't have a chance to interact more before it was merged. For the record though, everything I've tested so far today has worked perfectly. Beautiful work. Thanks so much :)

@tomchor
Copy link

tomchor commented Sep 17, 2023

I guess one question is: will the overlapping functionality need to be removed from Rasters?

@rafaqz
Copy link
Owner Author

rafaqz commented Sep 17, 2023

No worries, thanks for trying it out.

When its tagged we can delete the methods in Rasters and set new DD lower bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More general treatment of dimensions when plotting Add Makie Plot recipes
4 participants