warpRamp | R Documentation |
Warp colors in a color ramp
warpRamp(
ramp,
lens = 5,
divergent = TRUE,
expandFactor = 10,
plot = FALSE,
verbose = FALSE,
...
)
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 |
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.
Character vector of R colors, with the same length as the
input vector ramp
.
Other jam color functions:
alpha2col()
,
applyCLrange()
,
col2alpha()
,
col2hcl()
,
col2hsl()
,
col2hsv()
,
color2gradient()
,
fixYellowHue()
,
fixYellow()
,
getColorRamp()
,
hcl2col()
,
hsl2col()
,
hsv2col()
,
isColor()
,
kable_coloring()
,
makeColorDarker()
,
make_html_styles()
,
make_styles()
,
rgb2col()
,
setCLranges()
,
setTextContrastColor()
,
showColors()
,
unalpha()
BuRd <- rev(brewer.pal(11, "RdBu"));
BuRdPlus5 <- warpRamp(BuRd, lens=2, plot=TRUE);
BuRdMinus5 <- warpRamp(BuRd, lens=-2, plot=TRUE);
Reds <- 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);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.