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
Add error to direction argument of guide_*() #4364
The direction argument of guide_*() functions can only be "horizontal" or "vertical". At present an unhelpful error message is returned in case of error:
library("ggplot2")
ggplot(quakes,
aes(x=long,
y=lat,
colour=mag)) +
geom_point() +
guides(colour= guide_colorbar(direction="horiz"))
#> Error in if (!g$title.position %in% c("top", "bottom", "left", "right")) {: argument is of length zero
In line with the tidyverse style guide an error like this would be more suitable:
library("ggplot2")
ggplot(quakes,
aes(x=long,
y=lat,
colour=mag)) +
geom_point() +
guides(colour= guide_colorbar(direction="horiz"))
#> Error: The direction argument of guide_colorbar() must be either "vertical" or "horizontal"
Activity
teunbrand commentedon Dec 25, 2022
Thanks, that is indeed an inelegant error message. After #4879 gets merged, this will return the following error message:
Convert guides to ggproto (#4879)