added RColourBrewer to first pie chart as an example

This commit is contained in:
Jeremy Kidwell 2021-10-27 13:01:46 +01:00
parent ae36c3ed36
commit 064b27753a

View file

@ -5,6 +5,13 @@ output: html_document
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
# Load RColorBrewer
# install.packages("RColorBrewer")
library(RColorBrewer)
# Define colour palettes for plots below
3clr <- brewer.pal(3, "RdYlBu") # Using RdYlBu range to generate 3 colour palette: https://colorbrewer2.org/#type=diverging&scheme=RdYlBu&n=5
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
@ -34,7 +41,7 @@ Q3_freq
```
```{r Q25 bar/pie}
pie(Q25_frequencies, labels = c("Maybe", "No", "Yes"))
pie(Q25_frequencies, labels = c("Maybe", "No", "Yes"), col = 3clr)
```