-
Notifications
You must be signed in to change notification settings - Fork 9
/
colours.Rmd
36 lines (25 loc) · 951 Bytes
/
colours.Rmd
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
30
31
32
33
34
35
36
---
title: 'Colours'
---
```{r, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message=F)
library(tidyverse)
library(pander)
```
## Colours {-}
### Picking colours for plots {- #picking-colours}
See https://www.perceptualedge.com/articles/b-eye/choosing_colors.pdf for an
interesting discussion on picking colours for data visualisation.
Also check the
[ggplots docs for colour brewer](http://ggplot2.tidyverse.org/reference/scale_brewer.html)
and the [Colour Brewer website](http://colorbrewer2.org/).
### Named colours in R {- #named-colours}
```{r, results='asis'}
print.col <- Vectorize(function(col){
rgb <- grDevices::col2rgb(col)
sprintf("<span style='padding:1em; background-color: rgb(%s, %s, %s);'> </span> %s \n\n", rgb[1], rgb[2], rgb[3], col, rgb[1], rgb[2], rgb[3])
})
pandoc.p(print.col(colours()))
```
### ColourBrewer with ggplot {- #color-brewer}
See: http://ggplot2.tidyverse.org/reference/scale_brewer.html