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

How to avoid warnings when adding a secondary axis without breaks or labels in ggplot2 3.5.0? #5713

Closed
IndrajeetPatil opened this issue Feb 27, 2024 · 1 comment · Fixed by #5714
Labels
bug an unexpected problem or unintended behavior

Comments

@IndrajeetPatil
Copy link

Prior to this release, I could use the secondary axis only to display an additional label, and not include breaks or labels. To do so, I could do the following, but, as can be seen, warnings are generated, and I would like to avoid these warnings since the users of my package will also see these warnings.


library(ggplot2)

ggplot(mtcars, aes(wt, mpg)) +
  geom_point() +
  scale_y_continuous(sec.axis = dup_axis(name = "my secondary axis", breaks = NULL)) 
#> Warning in min(x): no non-missing arguments to min; returning Inf
#> Warning in max(x): no non-missing arguments to max; returning -Inf

ggplot(mtcars, aes(wt, mpg)) +
  geom_point() +
  scale_y_continuous(sec.axis = sec_axis(transform = I, name = "my secondary axis", breaks = NULL)) 
#> Warning in min(x): no non-missing arguments to min; returning Inf

#> Warning in min(x): no non-missing arguments to max; returning -Inf

Created on 2024-02-27 with reprex v2.1.0

@teunbrand
Copy link
Collaborator

Thanks for the report! This seems like a regression that should be fixed in ggplot2

@teunbrand teunbrand added the bug an unexpected problem or unintended behavior label Feb 27, 2024
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants