Monash Data Fluency, June 26
bit.ly/njt-monash-colour
nj_tierney
Sometimes the conversation ends there, and you provide them a few graphics that look better. Like this.
I guess the other parts of my motivation for this talk come from seeing a lot of people using bad/sub optimal colourscales.
There is great tooling in R to do the following:
This made sense to me, I know what colourblindness is, and I know what perceptually uniform means.
But I also have an honours degree in Psychological Science. My honours project studied the human visual system, in an area called psychophysics. I didn’t study colour, but we did need to learn about the visual system in neuropsychology.
This next section is inspired by Calder Hansen's The Science of Color Perception
This made sense to me, I know what colourblindness is, and I know what perceptually uniform means.
But I also have an honours degree in Psychological Science. My honours project studied the human visual system, in an area called psychophysics. I didn’t study colour, but we did need to learn about the visual system in neuropsychology.
Just as there are soundwaves that you can hear 🔉 👂
There are lightwaves that we see 🚥 👀
This combines physics, biology, and a bit of philosophy.
These lightwaves come in different shapes - different wavelengths:
From https://commons.wikimedia.org/wiki/File:EM_spectrum.svg
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Lightwaves enter our eyes, and we have the perception of colour.
As light enters the eye, it hits cells that are sensitive to light.
Image inspired by figure of responsivity of human eye from Wikipedia, data extracted from Colour & Vision Research laboratory at UCL's section on cones.
So what happens when we are exposed to a lot of these longer wavelengths of "red" light?
That information is then taken in to your brain and then you have the sensation of "red".
Well, kinda?
Well, kinda?
There are actually many different combinations of light waves that can get us to see different colours.
This means that colour is not just a single light waves, or a combination of many, but it is our perception of light
What happens if someone doesn't have some of these cones?
Or one of the cones isn't as responsive?
This is what we call colourblindness and colourweakness
Depending on which cones are missing, this means some sets of colours are indistinguishable from one another.
It affects up to 10% of males of European descent, and 1 in 200 women.
Without those cones, some colours look the same
Without those cones, some colours look the same
This is why traffic lights have position markings, instead of just the same position changing colour.
gif of good traffic light for different vision
vs
gif of bad traffic light with different vision
colorspace
colorspace
: protan()
, deutan()
, tritan()
transform colours.# Just rainbowrainbow(5)
## [1] "#FF0000" "#CCFF00" "#00FF66" "#0066FF" "#CC00FF"
# Rainbow into protanrainbow(5) %>% protan()
## [1] "#261D00" "#FFDF00" "#F7D25F" "#3769FF" "#0030FF"
rainbow(19) %>% protan() %>% swatchplot()
The prismatic
package provides check_color_blindness
:
rainbow(19) %>% check_color_blindness()
colorspace
provides a "Colour Vision Deficiency (CVD) Emulator" - cvd_emulator
.cvd_emulator("imgs/bom-heat-map.png")
These go by other names, and are just one of a set of many different colour representations (HSV, CIELAB, … ), and the literature on colourspace is wide and vast. These allow us to explore and explain colour in a way that makes sense to human.
These are human readable ways to describe colour, but ultimately get expressed into terms of RGB.
colorspace
to explore colour palettesspecplot
function from colorspace
. I have the nice colours used in the Australian heat data here, which we can view with swatchplot
from colorspace
, or show_cols
from scales
Qualitative: For coding categorical information, i.e., where no particular ordering of categories is available and every color should receive the same perceptual weight.
Sequential: For coding ordered/numeric information, i.e., where colors go from high to low (or vice versa).
Diverging: Designed for coding numeric information around a central neutral value, i.e., where colors diverge from neutral to two extremes.
(From the R help file on colour palettes)
BoM
Viridis
colorspace
sequential_hcl(n = 20, h = 300)
sequential_hcl(n = 20, h = c(360, 120))
Use sequential_hcl
and provide two hues
demoplot(type = "map")
demoplot(type = "heatmap")
protan
and use demoplotprotan
and use demoplot (compare to rainbow)hcl_palettes("qualitative", plot = TRUE)hcl_palettes("sequential", plot = TRUE)hcl_palettes("diverging", plot = TRUE)
protan
/deutan
/tritan
check_color_blindness
cvd_grid
cvd_emulator
qualitative_hcl
sequential_hcl
diverging_hcl
check_color_blindness
specplot
(combine with protan
and friends)demoplot
(combine with protan
and friends)colorspace::specplot()
colorspace::cvd_emulator()
hclwizard.com
colorspace::choose_palette()
colorspace::choose_color()
colorspace::hcl_color_picker()
colorspace::hcl_wizard()
nj_tierney
njtierney
nicholas.tierney@gmail.com
End.
rainbow(n = 20) %>% specplot()
rainbow(n = 20) %>% hclplot()
rainbow(n = 20) %>% protan() %>% specplot()
rainbow(n = 20) %>% protan() %>% hclplot()
rainbow(n = 20) %>% demoplot()
rainbow(n = 20) %>% protan() %>% demoplot()
rainbow(n = 20) %>% specplot()
pals::viridis(n = 20) %>% specplot()
rainbow(n = 20) %>% protan() %>% specplot()
pals::viridis(n = 20) %>% protan() %>% specplot()
rainbow(n = 20) %>% hclplot()
pals::viridis(n = 20) %>% hclplot()
rainbow(n = 20) %>% protan() %>% hclplot()
pals::viridis(n = 20) %>% protan() %>% hclplot()
rainbow(n = 20) %>% demoplot()
pals::viridis(n = 20) %>% demoplot()
rainbow(n = 20) %>% protan() %>% demoplot()
pals::viridis(n = 20) %>% protan() %>% demoplot()
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |