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

xlims! doesn't work with intervals #2611

Closed
ParadaCarleton opened this issue Jan 18, 2023 · 3 comments · Fixed by #3696
Closed

xlims! doesn't work with intervals #2611

ParadaCarleton opened this issue Jan 18, 2023 · 3 comments · Fixed by #3696

Comments

@ParadaCarleton
Copy link

julia> xlims!(-1.1..1.1)
ERROR: MethodError: no method matching xlims!(::IntervalSets.ClosedInterval{Float64}, ::Tuple{Nothing, Nothing})

Closest candidates are:
  xlims!(::Any, ::Any, ::Any)

Missing a method here.

@SimonDanisch
Copy link
Member

I don't see the advantage of this overload, when there is xlims!(-1.1, 1.1) which is easier to read & write... Giving multiple ways to do the same thing generally just makes it harder to read makie code, I'd say.

@ParadaCarleton
Copy link
Author

ParadaCarleton commented Jan 20, 2023

I don't see the advantage of this overload, when there is xlims!(-1.1, 1.1) which is easier to read & write... Giving multiple ways to do the same thing generally just makes it harder to read makie code, I'd say.

The actual use case looks more like:

x = -1..1
plot(x, f)
xlims!(x)

i.e. I want to be able to use the same variable for both xlims! and plot, instead of having to define two separate variables.

@t-bltg
Copy link
Collaborator

t-bltg commented Jan 22, 2023

I want to be able to use the same variable for both xlims! and plot, instead of having to define two separate variables.

Maybe,

x = -1..1
plot(x, sin)
xlims!(x.left, x.right)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
3 participants