Often I like to reduce the alpha value (level of transparency) of colours to identify patterns of over-plotting when displaying lots of data points with R. So, here is a tiny function that allows me to add an alpha value to a given vector of colours, e.g. a RColorBrewer palette, using `col2rgb`

and `rgb`

, which has an argument for `alpha`

, in combination with the wonderful `apply`

and `sapply`

functions.

The example below illustrates how this function can be used with colours provided in different formats, thanks to the `col2rgb`

function.

Read more »

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** mages' blog**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...