From b6fea6d8b7fa670990a785ab5bd93379d2f0239a Mon Sep 17 00:00:00 2001 From: KronosTheLate <61620837+KronosTheLate@users.noreply.github.com> Date: Mon, 18 Dec 2023 13:25:10 +0100 Subject: [PATCH] Make autolimits! default to current_axis() (#3469) * Default to current_axis() This PR makes `Makie.autolimits!` default to using `current_axis()` * Check is current_axis returns nothing * Actually call autolimits on curr_ax --- src/makielayout/blocks/axis.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/makielayout/blocks/axis.jl b/src/makielayout/blocks/axis.jl index 169ac3b7f89..8248577fbb8 100644 --- a/src/makielayout/blocks/axis.jl +++ b/src/makielayout/blocks/axis.jl @@ -898,14 +898,21 @@ function update_linked_limits!(block_limit_linking, xaxislinks, yaxislinks, tlim end """ + autolimits!() autolimits!(la::Axis) Reset manually specified limits of `la` to an automatically determined rectangle, that depends on the data limits of all plot objects in the axis, as well as the autolimit margins for x and y axis. +The argument `la` defaults to `current_axis()`. """ function autolimits!(ax::Axis) ax.limits[] = (nothing, nothing) return end +function autolimits!() + curr_ax = current_axis() + isnothing(curr_ax) && throw(ArgumentError("Attempted to call `autolimits!` on `current_axis()`, but `current_axis()` returned nothing.")) + autolimits!(curr_ax) +end function autolimits(ax::Axis, dim::Integer) # try getting x limits for the axis and then union them with linked axes