anchored.gradient: Create a color gradient with a color for zero
Description
Create a color gradient with a color for zeroUsage
anchored.gradient(minColor = "blue", maxColor = "red",
zeroColor = "white", z = NULL, vals = 100)
Arguments
minColor
what color corresponds to the minimum value?
maxColor
what color corresponds to the maximum value?
zeroColor
what color corresponds to the middle point value?
z
The vector of numbers corresponding to the colors?
vals
how many points should the final gradient have?
Details
Other functions (e.g., number.to.colors
) create a color gradient by taking a range (min and max) and begining with color 1 and ending with color 2.
The problem is that sometimes, there's a critical middle point (e.g., zero) and the min and max are not symmetric around the middle point.
This function aleviates that problem by creating a middle point for a fixed value (set to zero).