Function to extract wb colors as hex codes
wb_colours.Rd
Function to extract wb colors as hex codes
Return function to interpolate a wb color palette
Color scale constructor for wb colors
Fill scale constructor for wb colors
Usage
wb_cols(...)
wb_palettes
wb_pal(palette = "main", reverse = FALSE, ...)
scale_color_wb(palette = "main2", discrete = TRUE, reverse = FALSE, ...)
scale_fill_wb(palette = "main2", discrete = TRUE, reverse = FALSE, ...)
Arguments
- ...
Additional arguments passed to discrete_scale() or scale_fill_gradientn(), used respectively when discrete is TRUE or FALSE
- palette
Character name of palette in wb_palettes
- reverse
Boolean indicating whether the palette should be reversed
- discrete
Boolean indicating whether color aesthetic is discrete or not
Examples
if (FALSE) {
wb_cols()
wb_cols("red")
wb_cols("red", "blue")
wb_cols("blue", "red")
library(ggplot2)
ggplot(mtcars, aes(hp, mpg)) +
geom_point(color = wb_cols("red"),
size = 4, alpha = .8)
}
if (FALSE) {
wb_pal("main2")
wb_pal("neutral_all")(10)
}
if (FALSE) {
library(ggplot2)
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
geom_point(size = 4) +
scale_color_wb(palette = "main2")
ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Sepal.Length)) +
geom_point(size = 4, alpha = .6) +
scale_color_wb(discrete = FALSE, palette = "neutral_warm")
ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
geom_bar() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_fill_wb(palette = "main3", guide = "none")
}