Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make autolimits! default to current_axis() #3469

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/makielayout/blocks/axis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,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
Loading