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

Should non-spatial-specific plotting capabilities be moved to DimensionalData.jl? #495

Closed
tomchor opened this issue Aug 12, 2023 · 4 comments

Comments

@tomchor
Copy link

tomchor commented Aug 12, 2023

Consider the example below with some random numbers that could mean anything:

julia> using DimensionalData

julia> A = rand(X(3), Z(3))
3×3 DimArray{Float64,2} with dimensions: X, Z
 0.407639   0.927857   0.922065
 0.0907408  0.0185997  0.394484
 0.605405   0.0105796  0.0882944

If I want to plot this with GLMakie I have to do:

julia> using Rasters, GLMakie

julia> heatmap(Raster(A))

If I understand correctly, Rasters.jl deals with spatial data, while general labeled data is dealt with via DimensionalData.jl. From that perspective, it's counter-intuitive to me that in order to plot a DimArray I need to first transform it to a Raster first, given that A a priori doesn't have anything to do with spatial data. There are many 2D plots that aren't spatial.

Furthermore, as a developer, I think it would help the Julia community a lot to put capabilities into the more general DimensionalData as much as possible, instead of Rasters (which is more niche). As an example, I help maintain Oceananigans.jl and develop a package to calculate diagnostics, etc for it. It would be great to be able to use DimensionalData there for data visualization and manipulation (and in fact it has been discussed; here's one of the earliest attempts) but the community there has converged to Makie as a default for several reasons and including Rasters.jl as a dependency is a harder sell.

I also suspect that moving plotting to DimensionalData as much as possible would help prevent/diagnose bugs like #492, since it's one fewer layer to work with, but that's just my outsider impression.

I'm wondering what are everyone's thoughts on this.

Cheers

(Btw, I'm aware that you could plot it with Plots, but a lot of people seem to prefer Makie; for example it's been starred more than Plots on github.)

@rafaqz
Copy link
Owner

rafaqz commented Aug 13, 2023

This is 100% lack of time to do it, not some design.
I didnt have time to do Rasters Makie plots either, but @asinghvi17 did.

So its totally planned to add Makie to DD, just by who, when, is the problem. If you look at the Plots.jl recipes DimensionalData.jl does most plot types automatically.That will be some work to replicate for Makie.

You are welcome to do it, as Im not likely to in the short term.

@tomchor
Copy link
Author

tomchor commented Aug 14, 2023

So its totally planned to add Makie to DD, just by who, when, is the problem. If you look at the Plots.jl recipes DimensionalData.jl does most plot types automatically.That will be some work to replicate for Makie.

I see. Also, just to clarify, what I'm proposing here isn't to add more plotting routines to DD on top of the ones that already exist for Rasters; it's the move most of the Makie plotting capabilities (those that those pertain to spatial data specifically) to DD, and only then build on top of that accordingly.

Is that also what you're referring to?

@rafaqz
Copy link
Owner

rafaqz commented Aug 14, 2023

Well, Rasters only does heatmaps and line plots, so its not much of the potential functionality. Once there are some recipes, it will seem strange for users if there are big gaps - it does need to be a reasonably complete set at some point. But if you want to port the basics to DD to get started, go for it. Its in plotrecipes.jl in Rasters, here.

Note the main aim of those plots was what Rasters.rplot currently does, but is not yet possible to do with a Makie.jl recipe because of the automatic tiling and color bars. That stuff can't go to DD for now, and has to be in an extension to use Makie.jl things rather than just MakieCore.jl (here) .

@felixcremer
Copy link
Contributor

This was moved in DimensionalData 0.25.

@rafaqz rafaqz closed this as completed Oct 12, 2023
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

No branches or pull requests

3 participants