-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolour_guidance.Rmd
59 lines (45 loc) · 2.9 KB
/
colour_guidance.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: "Colour Guidance"
date: "`r Sys.Date()`"
scctemplate:
header:
site_branding: "Suffolk County Council"
navigation:
breadcrumb_trail:
- href: "index.html"
text: "Home"
- text: "Colour Guidance"
toc:
sticky: false
numbered: false
---
# A note on colour palettes, branding and accessibility
## Putting thought into requirements and responsibilities
The goal of colour palettes is to improve storytelling with data, whether it is to show continuous change in a value, differences between distinct categories or to highlight a specific category that you want to highlight.
Some questions we need to think about when choosing colour:
- Is it accessible for everyone, specifically for those with colour blindness/color vision deficiency?
- Is there an association with the colour we use (ie green is good/positive, red is bad/negative)
- Does it fit within the SCC brand?
## Sticking to the Suffolk County Council brand, where possible
The Suffolk County Council has its own colour schemes, the recognisable blues and orange found on the [website](https://www.suffolk.gov.uk/).
This <span style = "color:#2d6ca2">**blue (#2d6ca2)**</span> is used as the primary colour in graphs, with <span style = "color:#e8850c">**orange (#e8850c)**</span> as the secondary colour. Where applicable, the <span style = "color:#e2eefa">**light blue (#e2eefa)**</span> can used as a tertiary colour - but note that this not easily visible against white background (consider using a black outline).
Blue and Orange are colours that are distinct for most common forms of colour blindness/color vision deficiency. However, different types of graphs have vastly different requirements to tell a story, and where the number of categories exceeds three colours the SCC palette is not sufficient.
## Colourblind friendly palettes - **Viridis**
Therefore, instead of designing our own colour palette, I'd recommend the use of [viridis](https://github.com/sjmgarnier/viridis), for graphs with more than three categories. This package has visually appealing colour palettes, and improve graph readability for readers with **common** forms of color blindness and/or color vision deficiency. Note that for some specific forms, you may have to choose another palette within viridis (for example [seaborn](https://seaborn.pydata.org/tutorial/color_palettes.html), or [turbo](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html)).
```{r viridis_example, warning = FALSE, message = FALSE}
library(sccthemes)
library(gapminder)
library(dplyr)
asia_pop <- gapminder |>
filter(year == 1997 & continent == "Asia") |>
select(country, lifeExp, pop, gdpPercap) |>
top_n(5)
asia_pop$country <- forcats::fct_drop(asia_pop$country)
scc_piechart(
asia_pop,
asia_pop$gdpPercap,
asia_pop$country,
title = "GDP per Capita contribution percentage by county",
subtitle = "Five largest countries only"
)
```