Learn R Programming

fifer (version 1.1)

anchored.gradient: Create a color gradient with a color for zero

Description

Create a color gradient with a color for zero

Usage

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?

Value

a gradient of color

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).

See Also

string.to.colors, number.to.colors,

Examples

Run this code
#not shown yet

Run the code above in your browser using DataLab