| alphacol | R Documentation |
Create colors with a given transparency value, or mimick transparency by mixing with the background colour.
alphacol(col = par("col"), alpha = 1, alphamixing = NULL)
col |
a valid color specification |
alpha |
numeric, alpha level, between 0 and 1. |
alphamix |
logical, if |
alphacol follows the concept of alpha compositing:
A number \alpha between 0 and 1 controls how opaque the colour is.
When printing a colour A with alpha-level \alpha over a colour B,
the result becomes \alphaA + (1-\alpha)B.
Thus, alpha = 1 equals to a colour that overplots other colours, and for
alpha = 0, the colour is invisible.
R allows to define RGB colours with true alpha transparency, however, not
all devices support that. Therefore, the default behaviour of alphacol
is to mix the input colour A with the background colour found by par("bg").
A colour with alpha < 1 thus actually also prints opaque.
If you want to change this behaviour once, let alphamix = TRUE.
To change it globally, call ploptions(alphamix = TRUE)
a colour in RGB format. If alpha < 1, the colour is lighter than the input colour, see the details.
Ute Hahn, ute@imf.au.dk
ploptions for setting package options.
alphacol("red", alpha = .5, alphamixing = FALSE)
alphacol("red", alpha = .5, alphamixing = TRUE)
ploptions(alphamix = FALSE)
alphacol("red", alpha = .5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.