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
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"
The text was updated successfully, but these errors were encountered:
The guide system, as the last remaining chunk of ggplot2, has been rewritten
in ggproto. The axes and legends now inherit from a <Guide> class, which makes
them extensible in the same manner as geoms, stats, facets and coords
(#3329, @teunbrand). In addition, the following changes were made:
* Styling theme parts of the guide now inherit from the plot's theme
(#2728).
* Styling non-theme parts of the guides accept <element> objects, so that
the following is possible: `guide_colourbar(frame = element_rect(...))`.
* Primary axis titles are now placed at the primary guide, so that
`guides(x = guide_axis(position = "top"))` will display the title at the
top by default (#4650).
* Unknown secondary axis guide positions are now inferred as the opposite
of the primary axis guide when the latter has a known `position` (#4650).
* `guide_colourbar()`, `guide_coloursteps()` and `guide_bins()` gain a
`ticks.length` argument.
* In `guide_bins()`, the title no longer arbitrarily becomes offset from
the guide when it has long labels.
* The `order` argument of guides now strictly needs to be a length-1
integer (#4958).
* More informative error for mismatched
`direction`/`theme(legend.direction = ...)` arguments (#4364, #4930).
* `guide_coloursteps()` and `guide_bins()` sort breaks (#5152).
The
direction
argument ofguide_*()
functions can only be "horizontal" or "vertical". At present an unhelpful error message is returned in case of error:In line with the tidyverse style guide an error like this would be more suitable:
The text was updated successfully, but these errors were encountered: