Skip to content

error when setting breaks and labels to NULL in coord_radial() #6258

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

Closed
Yunuuuu opened this issue Dec 21, 2024 · 5 comments
Closed

error when setting breaks and labels to NULL in coord_radial() #6258

Yunuuuu opened this issue Dec 21, 2024 · 5 comments

Comments

@Yunuuuu
Copy link
Contributor

Yunuuuu commented Dec 21, 2024

library(ggplot2)
pie <- ggplot(mtcars, aes(x = factor(cyl), fill = factor(cyl))) +
    geom_bar(width = 1)
pie + coord_radial(theta = "x", inner.radius = 0.5) +
    scale_x_discrete(breaks = NULL, labels = NULL)
#> Error in switch(params$position, theta.sec = -Inf, top = -Inf, right = -Inf, : EXPR must be a length 1 vector

Created on 2024-12-22 with reprex v2.1.0
~

@teunbrand
Copy link
Collaborator

Thanks for the report! It appears that this no longer errors in the current development version. I think it may have been #5838 that had fixed this.

@Yunuuuu
Copy link
Contributor Author

Yunuuuu commented Jan 6, 2025

Thanks

@teunbrand
Copy link
Collaborator

teunbrand commented Feb 23, 2025

Somehow this issue seems to have come back, which probably means we should fix it and include a test to prevent its return.

@r2evans
Copy link
Contributor

r2evans commented Feb 23, 2025

FYI, one error I've seen

ggplot(mtcars, aes(mpg, disp)) +
  geom_point() +
  coord_radial() +
  scale_x_continuous(name=NULL, breaks=NULL)
# Error in switch(params$position, theta.sec = -Inf, top = -Inf, right = -Inf,  : 
#   EXPR must be a length 1 vector

@teunbrand
Copy link
Collaborator

My bad I was checking with the CRAN version. It does not cause any problems in the development version, so I'll close this again.

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

No branches or pull requests

3 participants