Description Usage Arguments See Also Examples
set_alpha
manipulates a vector of color representations in order
to setup the alpha value, and get the desired transparency level.
1 |
col |
a vector of colors |
alpha |
the value(s) of alpha for (each of) the colors. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.