powered by
Create gradient color scale with midpoint
gradient.color.scale( minval, maxval, n = 11, low = "blue", mid = "white", high = "red", midpoint = 0, ... )
A list with col and breaks components specifying the colors and breaks of the color scale.
col
breaks
The minimum value of the data to be colored
The maximum value of the data to be colored
The desired number of breaks (approximately)
The color for the low values
The color used for the midpoint of the gradient
The color used for the high values
The midpoint of the color scale
Arguments passed on to grDevices::colorRamp
grDevices::colorRamp
colors
colors to interpolate; must be a valid argument to col2rgb().
col2rgb()
bias
a positive number. Higher values give more widely spaced colors at the high end.
space
a character string; interpolation in RGB or CIE Lab color spaces.
interpolate
use spline or linear interpolation.
alpha
logical: should alpha channel (opacity) values be returned? It is an error to give a true value if space is specified.
Based on code from https://stackoverflow.com/a/10986203/5931362
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)
Run the code above in your browser using DataLab