Skip to content

Commit 98eee88

Browse files
committed
Implement fbang overrides too
1 parent 0e2ebdb commit 98eee88

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

ext/PyramidSchemeMakieExt.jl

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ miss2nan(x) = ismissing(x) ? NaN : x
1313
# hacks to get around DD hacks that get around Makie issues
1414
for p in (Heatmap, Image, Contour, Contourf, Contour3d, Spy, Surface)
1515
f = Makie.plotkey(p)
16+
fbang = Symbol(f, :!)
1617
@eval begin
1718
function Makie.$f(A::Pyramid; kwargs...)
1819
invoke(Makie.$f, Tuple{AbstractMatrix{<: Any}}, A; kwargs...)
@@ -23,6 +24,14 @@ for p in (Heatmap, Image, Contour, Contourf, Contour3d, Spy, Surface)
2324
function Makie.$f(gp::Makie.GridPosition, A::Observable{<: Pyramid}; kwargs...)
2425
invoke(Makie.$f, Tuple{typeof(gp), <:Observable{<: AbstractMatrix{<:Any}}}, gp, A; kwargs...)
2526
end
27+
28+
function Makie.$fbang(ax::Makie.AbstractAxis, A::Pyramid; kwargs...)
29+
invoke(Makie.$fbang, Tuple{typeof(ax), AbstractMatrix{<: Any}}, ax, A; kwargs...)
30+
end
31+
function Makie.$fbang(ax::Makie.AbstractAxis, A::Observable{<: Pyramid}; kwargs...)
32+
invoke(Makie.$fbang, Tuple{typeof(ax), <:Observable{<: AbstractMatrix{<:Any}}}, ax, A; kwargs...)
33+
end
34+
2635
Makie.expand_dimensions(::Type{$p}, p::Pyramid) = (p,)
2736
Makie.convert_arguments(::Type{$p}, p::Pyramid) = (p,)
2837
end
@@ -41,8 +50,6 @@ end
4150
Makie.expand_dimensions(::PyramidConversion, p::Pyramid) = (p,)
4251
Makie.convert_arguments(::PyramidConversion, p::Pyramid) = (p,)
4352

44-
45-
4653
Makie.plottype(::Pyramid) = Makie.Heatmap
4754

4855
function Makie.plot!(plot::Heatmap{<: Tuple{<: Pyramid}})
@@ -79,32 +86,14 @@ function Makie.plot!(plot::Heatmap{<: Tuple{<: Pyramid}})
7986

8087
datalimit = switchkeys(data_limits_ext, pyramid_ext)
8188
if intersects(pyramid_data_ext, data_limits_ext)
82-
@show data_limits_ext
89+
# @show data_limits_ext
8390
return (Ref{DD.AbstractDimMatrix}(miss2nan.(
8491
selectlevel(pyramid, datalimit, target_imsize = pixel_widths)
8592
)),)
8693
else
8794
return nothing # nothing changed so the downstream computation is not marked dirty
8895
end
8996
end
90-
# onany(plot, plot.arg1, plot.__pyramid_dataspace_positions, plot.__pyramid_pixelspace_positions) do pyramid, datapos, pixelpos
91-
# xyext = values.(extent(pyramid, (XDim, YDim)))
92-
# xval, yval = first(xyext), last(xyext)
93-
# pyramid_data_ext = Extent(X=xval, Y=yval)
94-
# pyramid_ext = extent(pyramid)
95-
96-
# data_limits_ext = Extent(X = extrema(first, datapos), Y = extrema(x -> x[2], datapos))
97-
# pixel_widths = Point2f(abs.(pixelpos[2] .- pixelpos[1]))
98-
99-
# datalimit = switchkeys(data_limits_ext, pyramid_ext)
100-
101-
# if intersects(pyramid_data_ext, data_limits_ext)
102-
# data[] = miss2nan.(
103-
# selectlevel(pyramid, datalimit, target_imsize = pixel_widths)
104-
# )
105-
# end
106-
# nothing
107-
# end
10897

10998
heatmap!(plot, plot.attributes, plot.__pyramid_data)
11099
end

0 commit comments

Comments
 (0)