Skip to contents

ggplot2 color scales using the colors for the IUCN Red List threat categories, as documented in this chart.

Usage

scale_color_iucn(...)

scale_fill_iucn(...)

scale_discrete_iucn(aesthetics, ...)

Arguments

...

Arguments passed on to ggplot2::discrete_scale (except for na.value which is already set according to the IUCN standard of #C1B5A5)

aesthetics

Character string or vector of character strings listing the name(s) of the aesthetic(s) that this scale works with. This can be useful, for example, to apply color settings to the color and fill aesthetics at the same time, via aesthetics = c("color", "fill").

Examples

library(ggplot2)
categories <- c("NE", "DD", "LC", "NT", "VU", "EN", "CR", "RE", "EW", "EX")
df <- data.frame(
  x = runif(1000, 0, 10), y = runif(1000, 0, 10),
  color = sample(categories, 1000, TRUE), shape = 21
)
ggplot(df) +
  geom_point(aes(x = x, y = y, fill = color), shape = 21) +
  scale_fill_iucn(name = "IUCN Category") +
  theme_classic()