How to change the alpha value of colours in R
alpha channel
,
R
,
rgb
,
Tutorials
col2rgb
and rgb
, which has an argument for alpha
, in combination with the wonderful apply
and sapply
functions. 1 2 3 4 5 6 7 8 |
|
The example below illustrates how this function can be used with colours provided in different formats, thanks to the
col2rgb
function. 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 26 27 28 29 |
|
Session Info
sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RCurl_1.95-4.1 bitops_1.0-5
No comments:
Post a Comment