Colours

Colour spaces and colour use

Roland Krause

MADS6

Monday, 9 December 2024

Introduction

Colours

Learning objectives

  • Know about colour spaces - RGB and HCL
  • Use fewer colours
  • Finding the right palette
  • Choose a palette for your project

How we see colors

Your turn

Take the quiz

05:00

Perception of colours

Human vision

  • Perception of light/dark contrasts
  • Yellow/blue contrasts
  • Green/red contrasts

Three types of color receptors

Representing color on a screen

RGB - Red Green Blue

  • The most commonly encountered color system.

  • Hexadecimal notation allows 16.7M colors

    • Red #FF0000
    • Blue #00FF00
    • Green #0000FF

System is additive, e.g. the maximal value #FFFFFF corresponds to white.

HCL - Hue, Chroma, Luminance

Configuration

Parameter Select Range
Hue 0 [0-360]
Chroma 100 [100-0]
Luminance 50 [50-100]

HCL scales are limited

Parameter Start Range
Hue 0 [0-360]
Chroma 0 [0-360]
Luminance 0 [0-360]

Choosing colours in HCL space

Use of color

Use of color

  1. Color as an extra dimension to map
  • Categorical values
  • Numerical values
  1. Color as a highlight

Application in the wild

538 polls - polls, use of repeated coding

Middle class jobs - two point comparison

Thatcher vs May - waffle chart

Color and context

Why is this not the default?

But this?

Palettes and their use

Types of palettes

Popular color spaces - Brewer - Viridis - Jet (Python)

Qualitative palettes

Use for unordered categorical data

  • Lighter colours (high luminance) are less distracting
  • Flashy colours are needed for points or lines

Sequential palettes

  • Ordered categorical data (choice of n)
  • Binned numerical data

The relation of color depth and numerical values is highly subjective.

Sequential palettes

  • Ordinal data (choice of n)
  • Numerical data

Diverging palettes

  • Opposing values
  • Few samples with high and low scores
  • Examples:
    • Correlation \(r^2 [-1, 1]\)
    • Bimodal distributions

How colors are selected

Choosing a color-blind friendly palette

All colors

viridis design

Tip

The colorBlindness package can render your palette in this fashion.

Too many colors

Continous, rainbow palette

Binning and another palette

Focusing on a few important points

As a table

Province Education Agriculture
V. De Geneve 53
1
Neuchatel 32
18
Rive Droite 29
47
Rive Gauche 29
28
Lausanne 28
19
La Vallee 20
15
Vevey 19
27
Neuveville 15
44
Sarine 13
45
Sion 13
63
Le Locle 13
17
Courtelary 12
17

Preferred - scatter plot

Developing a suitable color scheme

Taylor Swift

How to create a custom palette

colorspace package

HCL Picker and HCL wizard

HCL Picker

Existing color schemes

Online palette generators

Color Tool

Recommendations for your projects

Make active use of colour

  1. Motivate your choice
  2. No need to design your own palette
  3. Use fewer colors

In any case document and comment!

Before we stop

We discussed

  • Color use
  • Palettes
    • categorical/qualitative, sequential, diverging

Acknowledgements

Claus O. Wilke

Other materials

Thank you for your attention!