set_alpha {roahd} | R Documentation |
Function to setup alpha value for a set of colors
Description
set_alpha
manipulates a vector of color representations in order
to setup the alpha value, and get the desired transparency level.
Usage
set_alpha(col, alpha)
Arguments
col |
a vector of colors |
alpha |
the value(s) of alpha for (each of) the colors. |
See Also
Examples
original_col = c( 'blue', 'red', 'green', 'yellow' )
alpha_col = set_alpha( original_col, 0.5 )
alpha_col = set_alpha( original_col, c(0.5, 0.5, 0.2, 0.1 ) )
dev.new()
oldpar <- par(mfrow = c(1, 1))
par(mfrow = c(1, 2))
plot( seq_along( original_col ),
seq_along( original_col ),
col = original_col,
pch = 16,
cex = 2,
main = 'Original colors' )
plot( seq_along( alpha_col ),
seq_along( alpha_col ),
col = alpha_col,
pch = 16,
cex = 2,
main = 'Alpha colors' )
par(oldpar)
[Package roahd version 1.4.3 Index]