Learn R Programming

berryFunctions (version 1.22.5)

addFade: Color fade out

Description

Make existing colors fade away to white

Usage

addFade(col, fade = 0.3, target = "white", ...)

Value

character matrix with hexadecimal color codes.

Arguments

col

Vector of color names (colors), hexadecimal or integer that can be interpreted by col2rgb

fade

Level of fading towards target. between 0 (target) and 1 (col). Can also be a vector. DEFAULT: 0.3

target

Target color that should be faded into. DEFAULT: "white"

...

Further arguments passed to colorRamp

Author

Berry Boessenkool, berry-b@gmx.de, Feb 2016

See Also

addAlpha, colorRamp, colors

Examples

Run this code

plot(1:11, pch=16, cex=3, col=addFade(2, 10:0/10))
plot(1:11, pch=16, cex=3, col=addFade(2, 10:0/10, target="blue"))
plot(1:11, pch=16, cex=3, col=addFade(2, 10:0/10, target=3:4))
plot(1:21, pch=16, cex=3, col=addFade(2:3, 10:0/10))
plot(1:21, pch=16, cex=3, col=addFade(2:3, 10:0/10, target=4:5))
NewColors <- addFade(c("red","blue","yellow","green", "purple"), 0:200/200)
plot(runif(1000), col=NewColors, pch=16, cex=2)

Run the code above in your browser using DataLab