You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Confusing error when theme(legend.direction = .) incorrectly entered #4930
When running ggplot() with a legend and using theme(legend.position = .) to change the legend direction, an invalid argument causes an unclear error. I also feel like abbreviations should be allowed for this argument since it only accepts two strings.
library(ggplot2)
ggplot(mpg, aes(x = cty, fill = drv)) +
geom_histogram() +
theme(legend.direction = "v")
## Error in if (!g$title.position %in% c("top", "bottom", "left", "right")) { :
## argument is of length zero
Activity
teunbrand commentedon Dec 23, 2022
Thanks, that is indeed an inelegant error message. After #4879 gets merged, this will return the following error message:
Quoting from the tidyverse style guide:
So I don't think there is a good chance that ggplot2 will allow this as a partially matched argument.
teunbrand commentedon Dec 25, 2022
I just realised that this is a duplicate of #4364, so I'll close this issue in favour of the other one.
Convert guides to ggproto (#4879)