Closed
Description
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"