colToTransp | R Documentation |
Adding transparency to a color
colToTransp(col, percent = 50)
col |
color vector specified similar to the |
percent |
numeric between 0 and 100 giving the level of transparency. Defaults to 50. |
# Excepts hexadecimal strings, written colors, or numbers as input
colToTransp("#FF0000FF", 50)
colToTransp("black", 50)
colToTransp(2)
# Different shades of red
r80 <- colToTransp("red", 80)
r50 <- colToTransp("red", 50)
r20 <- colToTransp("red", 20)
barplot(rep(5, 4), col=c("red", r20, r50, r80), names.arg = 1:4)
# Vector as input
rain_transp <- colToTransp(rainbow(5), 50)
barplot(rep(5, 5), col = rain_transp, names.arg = 1:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.