From 064b27753aaf526591f608aacacc4a8fddba97f6 Mon Sep 17 00:00:00 2001 From: Jeremy Kidwell Date: Wed, 27 Oct 2021 13:01:46 +0100 Subject: [PATCH] added RColourBrewer to first pie chart as an example --- Connect Project R Markdown.Rmd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Connect Project R Markdown.Rmd b/Connect Project R Markdown.Rmd index 6d14cf2..7750add 100644 --- a/Connect Project R Markdown.Rmd +++ b/Connect Project R Markdown.Rmd @@ -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) ```