Learn R Programming

berryFunctions (version 1.4)

addAlpha: Make existing colors transparent

Description

Make existing colors semi-transparent (add alpha)

Usage

addAlpha(col,alpha = 1)

Arguments

col
vector of color names (colors) that can be interpreted by col2rgb
alpha
Level of (semi-)transparency. between 0 (transparent) and 1 (intransparent). DEFAULT: 1

Value

  • character vector with hexadecimal color codes.

See Also

rgb, colors, col2rgb

Examples

Run this code
addAlpha("red", c(0.1, 0.3, 0.6, 1))
NewColors <- addAlpha(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