Skip to contents

Fill scales based on Gavi color palette

Usage

scale_fill_gavi(palette = "standard", discrete = TRUE, reverse = FALSE, ...)

Arguments

palette

A palette. Defaults to standard palette, but other palettes also available. Full list: all, standard, millennial, main, strategy, vaccine, who_region, gavi_segment, world_bank, red_green, traffic, misc1, misc2, map_blue_red, map_blue_red2, map_orange_turquoise, map_green_red, map_blues, map_reds, map_greens.

discrete

Defaults to TRUE, keep if data is discrete. If continuous, used FALSE.

reverse

Reverses order of palette.

...

Additional arguments passed to ggplot2::discrete_scale() or ggplot2::scale_fill_gradientn(), used respectively when discrete is TRUE or FALSE

Examples

# Example one - use main palette as output has four colors needed
library(dplyr)
library(ggplot2)
wuenic %>%
 filter(iso3 == "AFG" & year == 2021) %>%
 ggplot(aes(vaccine, coverage, fill = vaccine)) +
 geom_bar(stat = "identity") +
 scale_fill_gavi(palette = "main", reverse = TRUE)


# Example two - the "misc1" palette has five colors, so palette takes first four shades
wuenic %>%
 filter(iso3 == "AFG" & year == 2021) %>%
 ggplot(aes(vaccine, coverage, fill = vaccine)) +
 geom_bar(stat = "identity") +
 scale_fill_gavi(palette = "misc1", reverse = TRUE)