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

Reduce warnings for ImageLike deprecation #3396

Merged
merged 3 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions src/basic_recipes/datashader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,7 @@ function convert_arguments(P::Type{<:Union{MeshScatter,Image,Surface,Contour,Con
operation=automatic, local_operation=identity)
pixel = Aggregation.get_aggregation(canvas; operation=operation, local_operation=local_operation)
(xmin, ymin), (xmax, ymax) = extrema(canvas.bounds)
xrange = range(xmin, stop = xmax, length = size(pixel, 1))
yrange = range(ymin, stop = ymax, length = size(pixel, 2))
return convert_arguments(P, xrange, yrange, pixel)
return convert_arguments(P, xmin .. xmax, ymin .. ymax, pixel)
end

# TODO improve color legend API, to not need a fake plot like this
Expand Down
2 changes: 1 addition & 1 deletion src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Base.@deprecate_binding ContinuousSurface VertexGrid true

function Base.getproperty(scene::Scene, field::Symbol)
if field === :px_area
@warn "`.px_area` got renamed to `.viewport`, and means the area the scene maps to in device indepentent units, not pixels. Note, `size(scene) == widths(scene.viewport[])`"
@warn "`.px_area` got renamed to `.viewport`, and means the area the scene maps to in device independent units, not pixels. Note, `size(scene) == widths(scene.viewport[])`"
return scene.viewport
end
return getfield(scene, field)
Expand Down
2 changes: 1 addition & 1 deletion src/makielayout/blocks/colorbar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function initialize_block!(cb::Colorbar)
inspectable=false
)
image!(blockscene,
lift(x-> LinRange(extrema(x)..., 2), xrange), lift(y-> LinRange(extrema(y)..., 2), yrange), continous_pixels;
lift(extrema, xrange), lift(extrema, yrange), continous_pixels;
colormap = colormap,
visible = show_continous,
inspectable = false
Expand Down
8 changes: 7 additions & 1 deletion test/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ end
logger.logs[1].message)
scene = Scene(; size=(600, 450))
msg = @depwarn_message scene.px_area
@test occursin(".px_area` got renamed to `.viewport`, and means the area the scene maps to in device indepentent units",
@test occursin(".px_area` got renamed to `.viewport`, and means the area the scene maps to in device independent units",
msg)
# @test_deprecated seems to be broken on 1.10?!
msg = @depwarn_message pixelarea(scene)
Expand All @@ -46,4 +46,10 @@ end
msg = @depwarn_message ContinuousSurface()
@test occursin("ContinuousSurface is deprecated", msg)
end
@testset "AbstractVector ImageLike" begin
msg = @depwarn_message image(1:10, 1..10, zeros(10, 10))
@test occursin("Encountered an `AbstractVector` with value 1:10 on side x", msg)
msg = @depwarn_message image(1..10, 1:10, zeros(10, 10))
@test occursin("Encountered an `AbstractVector` with value 1:10 on side y", msg)
end
end
Loading