From 916c9ef161c384e00d170df0ced99d2b07d17f67 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 27 Nov 2024 14:10:21 -0500 Subject: [PATCH] add a `reset_limits` kwarg to GeoAxis to ignore that on insertion ONLY --- src/geoaxis.jl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/geoaxis.jl b/src/geoaxis.jl index 3fcb8130..2d0c5036 100644 --- a/src/geoaxis.jl +++ b/src/geoaxis.jl @@ -823,15 +823,24 @@ end # This is where we override the stuff to make it our stuff. function Makie.plot!(axis::GeoAxis, plot::Makie.AbstractPlot) + # deal with setting the transform_func correctly source = pop!(plot.kw, :source, axis.source) transformfunc = lift(create_transform, axis.dest, source) + trans = Makie.Transformation(transformfunc; get(plot.kw, :transformation, Attributes())...) plot.kw[:transformation] = trans + + # remove the reset_limits kwarg if there is one, this determines whether to automatically reset limits + # on plot insertion + reset_limits = to_value(pop!(plot.kw, :reset_limits, true)) + + # actually plot Makie.plot!(axis.scene, plot) + # some area-like plots basically always look better if they cover the whole plot area. # adjust the limit margins in those cases automatically. - Makie.needs_tight_limits(plot) && Makie.tightlimits!(axis) - if Makie.is_open_or_any_parent(axis.scene) + Makie.needs_tight_limits(plot) && reset_limits && Makie.tightlimits!(axis) + if Makie.is_open_or_any_parent(axis.scene) && reset_limits Makie.reset_limits!(axis) end return plot