addAlpha | R Documentation |
Make existing colors semi-transparent (add alpha)
addAlpha(col, alpha = 0.3)
col |
Vector of color names ( |
alpha |
Level of semi-transparency. between 0 (transparent) and 1 (intransparent). Can also be a vector. DEFAULT: 0.3 |
character vector with hexadecimal color codes.
Berry Boessenkool, berry-b@gmx.de, June 2014 Based on suggestion by Mathias Seibert, Dec. 2013
addFade
, rgb
, colors
, col2rgb
addAlpha("red", c(0.1, 0.3, 0.6, 1))
addAlpha(1:3)
addAlpha(1:3, 1:3/3)
NewColors <- addAlpha(c("red","blue","yellow","green", "purple"), 0:200/200)
plot(runif(1000), col=NewColors, pch=16, cex=2)
# use addFade for line segments, because of overlapping dots
set.seed(1); x <- cumsum(rnorm(30)) ; y <- x-2
plot(x, type="n")
segments(x0=1:29,y0=head(x,-1), x1=2:30,y1=x[-1], col=addAlpha(4, 29:0/30), lwd=10)
segments(x0=1:29,y0=head(y,-1), x1=2:30,y1=y[-1], col=addFade (4, 29:0/30), lwd=10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.