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

default xlim and ylim in qplot are not supportd when non missing #4027

Closed
moodymudskipper opened this issue May 24, 2020 · 1 comment · Fixed by #4419
Closed

default xlim and ylim in qplot are not supportd when non missing #4027

moodymudskipper opened this issue May 24, 2020 · 1 comment · Fixed by #4419
Labels
bug an unexpected problem or unintended behavior scales 🐍
Milestone

Comments

@moodymudskipper
Copy link

See below. I think it's against the principles laid out in the tidyverse principle book, it can be fixed by using c(NA_real_, NA_real_) as a default.

The issue arose as I was writing a wrapper around qplot and it choked when passing the parameters xlim = xlim, ylim = ylim.

library(ggplot2)

# works
qplot(Sepal.Width, Sepal.Length, data = iris)

# doesn't work
qplot(Sepal.Width, Sepal.Length, data = iris, xlim = c(NA,NA))
#> Error in UseMethod("limits"): no applicable method for 'limits' applied to an object of class "logical"

# works
qplot(Sepal.Width, Sepal.Length, data = iris, xlim = c(NA_real_,NA_real_))

Created on 2020-05-25 by the reprex package (v0.3.0)

@clauswilke
Copy link
Member

You are correct, though we tend to discourage use of qplot() as much as possible. In any case, feel free to create a PR to fix this.

@thomasp85 thomasp85 added bug an unexpected problem or unintended behavior scales 🐍 labels Aug 31, 2020
@thomasp85 thomasp85 added this to the ggplot2 3.3.4 milestone Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior scales 🐍
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants