Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Makie/src/basic_recipes/datashader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -711,12 +711,14 @@ function Makie.plot!(p::HeatmapShader)

map!(xy_to_rect, p.attributes, [:x, :y], :data_limits)


T = eltype(p.image[].data) <: Colors.Colorant ? RGB{Float32} : Float32
map!(p.attributes, [:image, :x, :y, :max_resolution, :data_limits, :colorrange], [:x_endpoints, :y_endpoints, :overview_image, :computed_colorrange]) do image, x, y, max_resolution, image_area, crange
x, y, img = resample_image(x, y, image.data, max_resolution, image_area)
cr = calculate_colorrange(img, crange)
if image.lowres_background
val = cr isa Vec2 ? mean(cr) : 0.0f0 # TODO color mean?
_img = Float32[val for _ in 1:1, _ in 1:1]
_img = [T(val) for _ in 1:1, _ in 1:1]
else
_img = img
end
Expand All @@ -727,7 +729,7 @@ function Makie.plot!(p::HeatmapShader)
p.attributes,
[:image, :x, :y, :max_resolution, :slow_limits],
[:lx_endpoints, :ly_endpoints, :limit_image, :l_visible],
init = (p.x[], p.x[], fill(0.0f0, 2, 2), false)
init = (p.x[], p.x[], fill(zero(T), 2, 2), false)
) do image, x, y, max_resolution, limits
xe_ye_oimg = resample_image(x, y, image.data, max_resolution, limits)
isnothing(xe_ye_oimg) && return nothing
Expand Down
Loading