warpRamp {jamba} | R Documentation |
Warp colors in a color ramp
Description
Warp colors in a color ramp
Usage
warpRamp(
ramp,
lens = 5,
divergent = TRUE,
expandFactor = 10,
plot = FALSE,
verbose = FALSE,
...
)
Arguments
ramp |
character vector of R colors |
lens |
numeric lens factor, centered at zero, where positive values cause colors to change more rapidly near zero, and negative values cause colors to change less rapidly near zero and more rapidly near the extreme. |
divergent |
logical indicating whether the |
expandFactor |
numeric factor used to expand the color ramp
prior to selecting the nearest warped numeric value as the
result of |
plot |
logical indicating whether to plot the input and
output color ramps using |
verbose |
logical indicating whether to print verbose output. |
... |
additional parameters are passed to |
Details
This function takes a vector of colors in a color ramp (color gradient) and warps the gradient using a lens factor. The effect causes the color gradient to change faster or slower, dependent upon the lens factor.
The main intent is for heatmap color ramps, where the color gradient changes are not consistent with meaningful numeric differences being shown in the heatmap. In short, this function enhances colors.
Value
character
vector of R colors, with the same length as the
input vector ramp
.
See Also
Other jam color functions:
alpha2col()
,
applyCLrange()
,
col2alpha()
,
col2hcl()
,
col2hsl()
,
col2hsv()
,
color2gradient()
,
fixYellow()
,
fixYellowHue()
,
getColorRamp()
,
hcl2col()
,
hsl2col()
,
hsv2col()
,
isColor()
,
kable_coloring()
,
makeColorDarker()
,
rainbow2()
,
rgb2col()
,
setCLranges()
,
setTextContrastColor()
,
showColors()
,
unalpha()
Examples
BuRd <- rev(RColorBrewer::brewer.pal(11, "RdBu"));
BuRdPlus5 <- warpRamp(BuRd, lens=2, plot=TRUE);
BuRdMinus5 <- warpRamp(BuRd, lens=-2, plot=TRUE);
Reds <- RColorBrewer::brewer.pal(9, "Reds");
RedsL <- lapply(nameVector(c(-10,-5,-2,0,2,5,10)), function(lens){
warpRamp(Reds, lens=lens, divergent=FALSE)
});
showColors(RedsL);