tcol: Transparent colors

View source: R/plot_extra.R

tcolR Documentation

Transparent colors

Description

Add alpha transparency to colors.

Usage

tcol(col, alpha = 1)

Arguments

col

a vector of color names, hexadecimal strings, or integers which correspond to the current palette

alpha

the alpha transparency in [0,1]

See Also

as.hexmode; col2rgb; adjustcolor; rgb;

Examples

cols <- c('red', 'green', 'blue')

## a normal plot
plot(rnorm(100), col = tcol(cols), pch = 16, cex = 4)

## more transparent
plot(x <- rnorm(100), col = tcol(cols, 0.5), pch = 16, cex = 4)

## hexadecimal strings also work
cols <- c('#FF0000', '#00FF00', '#0000FF')
plot(rnorm(100), col = tcol(cols, c(0.2, 0.4, 1)), pch = 16, cex = 4)


raredd/rawr documentation built on May 19, 2024, 1:02 p.m.