Skip to content

Commit

Permalink
Make autolimits! default to current_axis() (#3469)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
KronosTheLate authored Dec 18, 2023
1 parent 8d53784 commit b6fea6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/makielayout/blocks/axis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b6fea6d

Please sign in to comment.