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

More general treatment of dimensions when plotting #524

Closed
tomchor opened this issue Aug 27, 2023 · 1 comment · Fixed by #528
Closed

More general treatment of dimensions when plotting #524

tomchor opened this issue Aug 27, 2023 · 1 comment · Fixed by #528

Comments

@tomchor
Copy link

tomchor commented Aug 27, 2023

As discussed in rafaqz/Rasters.jl#492, it would be nice to be able to choose what dimensions go in which axis when plotting something. At the moment DD only deals with dimensions X, Y, and Z, and we may get an error when a dimension that's called something different is part of a DimArray that's being plotted. In many fields the axis names can be different, thus the flexibility of choosing each axis' dimension is very useful in general. While one can always rename the axis, this is not always feasible (there's more details as to why here).

One idea suggested by @rafaqz is to add a dims keyword that would rename the axis accordingly (to X, Y or Z) behind the scenes. It would work like:

heatmap(DA; dims=(X=:fX, Y=:fY))

Another idea is to modify the code to plot the axes without any renaming, since plotting the data using the DimArray's actual dimension names is more informative. Then a possible user interface would be the same as the one already used by heatmap (and similar to what python-xarray uses, for example). As an examle, a DimArray with dimensions x1 and x2 can be plotted as

heatmap(DA, x=:x1, y=:x2)

cc @rafaqz

PS.: I found an old issue of mine that also discussed this: #432

@rafaqz
Copy link
Owner

rafaqz commented Aug 28, 2023

Oh right we should have left the old one open 😂

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 a pull request may close this issue.

2 participants