UNHCR ggplot2 color scales
Usage
scale_color_unhcr_c(
...,
type = "sequential",
palette = 1,
direction = 1,
na.value = "#E9E9E9",
guide = "colourbar"
)
scale_color_unhcr_d(
...,
type = "qualitative",
palette = 1,
direction = 1,
nmax = NULL,
order = NULL,
na.value = "#E9E9E9"
)
scale_colour_unhcr_c(
...,
type = "sequential",
palette = 1,
direction = 1,
na.value = "#E9E9E9",
guide = "colourbar"
)
scale_colour_unhcr_d(
...,
type = "qualitative",
palette = 1,
direction = 1,
nmax = NULL,
order = NULL,
na.value = "#E9E9E9"
)
scale_fill_unhcr_c(
...,
type = "sequential",
palette = 1,
direction = 1,
na.value = "#E9E9E9",
guide = "colourbar"
)
scale_fill_unhcr_d(
...,
type = "qualitative",
palette = 1,
direction = 1,
nmax = NULL,
order = NULL,
na.value = "#E9E9E9"
)
Arguments
- ...
Other arguments passed on to [discrete_scale()] or [continuous_scale()] to control name, limits, breaks, labels and so forth
- type
One of \"sequential\", \"diverging\" or \"qualitative\"
- palette
If a string, will use that named palette. If a number, will index into the list of palettes of appropriate `type`
- direction
Sets the order of colors in the scale. If 1, the default, colors are as output by [unhcr_pal()]. If -1, the order of colors is reversed
- na.value
Missing values will be replaced with this value.
- guide
A function used to create a guide or its name. See
guides()
for more information.- nmax
Maximum number of different colors the palette should contain. If not provided, is calculated automatically from the data.
- order
Numeric vector listing the order in which the colors should be used. Default is
1:nmax
.
Examples
library(ggplot2)
ggplot(msleep, aes(vore, sleep_total, fill = vore)) +
geom_boxplot() +
scale_fill_unhcr_d(palette = 1, direction = -1)