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

Conversation

KronosTheLate
Copy link
Contributor

This PR makes Makie.autolimits! default to using current_axis()

Type of change

Delete options that do not apply:

  • New feature (non-breaking change which adds functionality)

Checklist

  • Added an entry in NEWS.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation

This PR makes `Makie.autolimits!` default to using `current_axis()`
@KronosTheLate KronosTheLate changed the title Default to current_axis() Make autolimits! default to current_axis() Dec 13, 2023
"""
function autolimits!(ax::Axis)
ax.limits[] = (nothing, nothing)
return
end
autolimits!() = autolimits!(current_axis())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should check for current_axis returning nothing!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a very good idea. I implemented this check. Below is a demo:

julia> using GLMakie

julia> Makie.autolimits!
autolimits! (generic function with 4 methods)

julia> function autolimits!()
           curr_ax = current_axis()
           isnothing(curr_ax)  &&  throw(ArgumentError("Attempted to call `autolimits!` on `current_axis()`, but `current_axis()` returned nothing."))
           autolimits!()
       end
autolimits! (generic function with 1 method)

julia> autolimits!()
ERROR: ArgumentError: Attempted to call `autolimits!` on `current_axis()`, but `current_axis()` returned nothing.
Stacktrace:
 [1] autolimits!()
   @ Main ./REPL[5]:3
 [2] top-level scope
   @ REPL[6]:1

@SimonDanisch SimonDanisch merged commit b6fea6d into MakieOrg:master Dec 18, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants