Skip to content

Commit

Permalink
add a reset_limits kwarg to GeoAxis to ignore that on insertion ONLY
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Nov 27, 2024
1 parent 8511ba4 commit 916c9ef
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/geoaxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 916c9ef

Please sign in to comment.