-
Notifications
You must be signed in to change notification settings - Fork 42
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
Towards a nicer Makie recipe #720
Comments
I just ran into an issue trying to plot a Raster using GeoMakie :D Consider the following: using RasterDataSources, Rasters, ArchGDAL, CairoMakie, GeoMakie
ras = Raster(EarthEnv{HabitatHeterogeneity}, :homogeneity) # habitat homogeneity to neighbouring pixel
surface(ras[:homogeneity]; axis = (; type = GeoAxis)) This causes an error: ERROR: MethodError: no method matching setindex!(::Nothing, ::Tuple{String, String}, ::Symbol, ::Symbol)
Stacktrace:
[1] surface(A::Raster{…}; x::Nothing, y::Nothing, colorbarkw::@NamedTuple{}, attributes::@Kwargs{…})
@ DimensionalDataMakie ~/.julia/dev/DimensionalData/ext/DimensionalDataMakie.jl:143
[2] top-level scope
@ ~/.julia/dev/GeoMakie/examples/rasters.jl:13
Some type information was truncated. Use `show(err)` to see complete types. because the plotting code assumes that surface is always plotted in a LScene, and more importantly it doesn't query what kind of axis has been created. This can be solved independently, but it's something which I feel could be solved more cleanly with this approach. |
This all sounds good to me. But there are potential problems like: we add a I think we will need an example PR to show if this is viable or not, I suspect currently its not. Edit: but we should do it anyway, and maybe just keep our own methods until the other things can be moved somewhere else too. |
FYI, function Makie.expand_dimensions(::Makie.ImageLike, raster::AbstractRaster)
return Makie.convert_arguments(Makie.ImageLike(), raster)
end just works. I ran into this issue with GeoMakie's meshimage recently while trying to plot a Raster through it. We can also avoid evaling things and go through |
Are you saying we just need to add that method? I don't totally follow like what does "just works" mean exactly here |
Yeah we just need to add expand dimensions for each trait to make DimArray handling generic across traits! |
DimensionalData.jl/ext/DimensionalDataMakie.jl Lines 353 to 357 in 58dedd6
|
Ah should probably be AbstractDimMatrix? Maybe a typo |
I'll fix in the PR and see if anything breaks :D |
Ok beat me to it |
Unfortunately #747 doesn't seem to solve the issue of dimensional axes. I can't actually see where the stack overflow is happening though. |
It occurs to me that dimensional axes are dimensional, and we can use Makie's new unit integration to deal with them.
For example, instead of defining conversions in convert_arguments, we might also define
expand_dimensions
for dimensional arrays, so that Makie can pick up on the dimension of the unit. Defining a custom dim conversion might also allow axis modifications like default labels, without the need to override the basicplot!
function.This isn't particularly urgent, but would be (a) nice to have and (b) pave the way for more such integration in the Makie ecosystem.
The text was updated successfully, but these errors were encountered: