gradient.color.scale: Create gradient color scale with midpoint

View source: R/gradient_color_scale.R

gradient.color.scaleR Documentation

Create gradient color scale with midpoint

Description

Create gradient color scale with midpoint

Usage

gradient.color.scale(
  minval,
  maxval,
  n = 11,
  low = "blue",
  mid = "white",
  high = "red",
  midpoint = 0,
  ...
)

Arguments

minval

The minimum value of the data to be colored

maxval

The maximum value of the data to be colored

n

The desired number of breaks (approximately)

low

The color for the low values

mid

The color used for the midpoint of the gradient

high

The color used for the high values

midpoint

The midpoint of the color scale

...

Arguments passed to grDevices::colorRamp

Value

A list with col and breaks components specifying the colors and breaks of the color scale.

References

Based on code from https://stackoverflow.com/a/10986203/5931362

Examples

data(grave)
lr = logrr(grave)
grad = gradient.color.scale(min(lr$v, na.rm = TRUE), max(lr$v, na.rm = TRUE))
plot(lr, col = grad$col, breaks = grad$breaks)

smacpod documentation built on Oct. 31, 2024, 1:08 a.m.