colAlpha: Add an alpha chanel to any color

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/colAlpha.R

Description

Make any color have transparancy by adding an alpha chanel

Usage

1
colAlpha(col, alpha = 1)

Arguments

col

the color to be modified

alpha

the alpha level to be added

Details

This function converts a color to red, blue, green components and then adds the desired alpha level

Value

A character vector of the desired colors

Author(s)

Andy Rominger <ajrominger@gmail.com>

See Also

hsv, rgb, col2rgb

Examples

1
2
3
4
## demonstrates use of the alpha argument: we can specify simple colors and use them in plots
## along with semi-transparent versions of them
cols <- c('red', 'blue', 'green')
plot(1:3, col=cols, bg=colAlpha(cols, alpha=c(0.7, 0.4, 0.1)), pch=21, cex=2, lwd=2)

ajrominger/socorro documentation built on Jan. 3, 2020, 6:25 a.m.