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