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

Fix _lookup_to_vector and _lookup_to_interval #776

Merged
merged 3 commits into from
Aug 21, 2024
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: 2 additions & 2 deletions ext/DimensionalDataMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@ function Makie.convert_arguments(t::SurfaceLikeCompat, A::AbstractDimMatrix)
end
function Makie.convert_arguments(t::Makie.ImageLike, A::AbstractDimMatrix)
A1 = _prepare_for_makie(A)
xs, ys = map(_lookup_to_intervals, lookup(A))
xs, ys = map(_lookup_to_interval, lookup(A))
# the following will not work for irregular spacings, we'll need to add a check for this.
return xs, ys, last(Makie.convert_arguments(t, parent(A1)))
end
function Makie.convert_arguments(
t::Makie.CellGrid, A::AbstractDimMatrix
)
A1 = _prepare_for_makie(A)
xs, ys = map(_lookup_to_axis, lookup(A1))
xs, ys = map(_lookup_to_vector, lookup(A1))
return xs, ys, last(Makie.convert_arguments(t, parent(A1)))
end
function Makie.convert_arguments(t::Makie.VolumeLike, A::AbstractDimArray{<:Any,3})
Expand Down
13 changes: 13 additions & 0 deletions test/plotrecipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,19 @@ end
A2m[3] = missing
A2rgb = rand(RGB, X(10:10:100), Y(['a', 'b', 'c']))

#Test whether the conversion functions work
#TODO once surface2 is corrected to use the plottrait this should
#already be tested with the usual plotting functions
M.convert_arguments(M.CellGrid(), A2)
M.convert_arguments(M.VertexGrid(), A2)
M.convert_arguments(M.ImageLike(), A2)

M.convert_arguments(M.CellGrid(), A2u)
M.convert_arguments(M.VertexGrid(), A2u)
M.convert_arguments(M.ImageLike(), A2u)



fig, ax, _ = M.plot(A2)
M.plot!(ax, A2)
fig, ax, _ = M.plot(A2m)
Expand Down
Loading