-
Notifications
You must be signed in to change notification settings - Fork 34
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
Plotting RGB Rasters with Makie #518
Comments
Full stack trace always helps with those ideas ;) |
Here you go!
|
Yeah seems we are not handling colors... this will all move to DimensionalData.jl very soon though, we can fix there |
All right. I figured out just passing dimensions as x and y arguments fixes it, even though I don't really understand why.
|
Yeah its just routing around the explicit method that does that. Although do realise that can put the pixels in the wrong place... gdal lookup values are at the start of the pixel not the middle. |
This fails currently, because we explicitly convert the data to Float32 in Rasters.jl/ext/RastersMakieExt/plotrecipes.jl Line 350 in 7eec50c
If I remove the Float32 there, image(rgba_raster) works and the heatmap call fails while constructing the Colorbar see error below. julia> heatmap(rgba_raster, colormap = rgba_raster)
ERROR: Neither heatmap nor any of its children use a colormap. Cannot create a Colorbar from this plot, please create it manually.
If this is a recipe, one needs to overload `Makie.extract_colormap(::Heatmap)` to allow for the automatical creation of a Colorbar.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] Colorbar(fig_or_scene::GridPosition, plot::Heatmap{Tuple{Vector{Float32}, Vector{Float32}, Matrix{RGBA{Float32}}}}; kwargs::Base.Pairs{Symbol, String, Tuple{Symbol}, NamedTuple{(:label,), Tuple{String}}})
@ Makie ~/.julia/packages/Makie/NrrbP/src/makielayout/blocks/colorbar.jl:93
[3] heatmap(A::Raster{RGBA{Float64}, 2, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}, Tuple{}, Matrix{RGBA{Float64}}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata, Missing}; x::Nothing, y::Nothing, colorbarkw::NamedTuple{(), Tuple{}}, attributes::Base.Pairs{Symbol, Raster{RGBA{Float64}, 2, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}, Tuple{}, Matrix{RGBA{Float64}}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata, Missing}, Tuple{Symbol}, NamedTuple{(:colormap,), Tuple{Raster{RGBA{Float64}, 2, Tuple{X{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}, Y{DimensionalData.Dimensions.LookupArrays.Sampled{Int64, UnitRange{Int64}, DimensionalData.Dimensions.LookupArrays.ForwardOrdered, DimensionalData.Dimensions.LookupArrays.Regular{Int64}, DimensionalData.Dimensions.LookupArrays.Points, DimensionalData.Dimensions.LookupArrays.NoMetadata}}}, Tuple{}, Matrix{RGBA{Float64}}, Symbol, DimensionalData.Dimensions.LookupArrays.NoMetadata, Missing}}}})
@ DimensionalDataMakie ~/Documents/DDPlotting/dev/DimensionalData/ext/DimensionalDataMakie.jl:147
[4] top-level scope
@ REPL[10]:1 |
Hmm what does Makie do for missing value in RGB? transparency? We could pass I guess the current method should dispatch on |
I used to be able to plot RGBA rasters with Makie using heatmap, but some recent version apparently broke this. I now get an error message that says
Converting to an Array and then plotting still works. Any idea what broke this?
This triggers the error:
The text was updated successfully, but these errors were encountered: