knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "plots/PLOTTING-"
)
  library(ramboseli)

Custom color palettes

Emily and Emily and I talked about how it would be neat to create custom color palettes for plots that are based on dominant hues in photos from Amboseli. I created examples of such palettes based on the photos below, and I added some functions to this package so that you can use them in an R plot.


div_earthsky


Photo by Sergey Pesterev

By default, there are 11 colors:

make_palette("div_earthsky")

It's called div_earthsky because it's a diverging color palette, which is useful when both low and high values are interesting and there is a meaningful, well-defined midpoint in the data. You can make make smaller palettes like this:

make_palette("div_earthsky", 5)

If you need more than 11 colors, you can use a continuous palette to interpolate between the existing colors:

pal <- make_palette(name = "div_earthsky", n = 100, type = "continuous")
image(volcano, col = pal)

seq_swelling


make_palette("seq_swelling")

seq_dryseason


make_palette("seq_dryseason")

seq_wetseason


make_palette("seq_wetseason")


amboseli/ramboseli documentation built on May 14, 2024, 7:36 p.m.