Intro to Programming & Data Viz
Jill P. Naiman
Summer 2020
Lecture 6
Last time
- What is data viz?
- What do we have to consider when we do data viz?
- Conceptual overview of topics in data viz
- Practice more with Python
This time
- Colors - what are they really?
- Color mapping - mapping data to colors
- Visual Encoding in general
How Do Colors Work?
Rods (low-light) and cones (color) mediate vision. Humans have about 20 times
as many rods (120 million) as cones (6 million).
Cones see in the colors red, green and blue.
How Do Colors Work?
Rods (low-light) and cones (color) mediate vision. Humans have about 20 times
as many rods (120 million) as cones (6 million).
Cones see in the colors red, green and blue.
Color Matching Function
The R,G, & B cones have different levels of responsiveness to different wavelenghts of light.
Below shows how responsive each type of cone is to a specific wavelength of light.
Color Matching Function
The R,G, & B cones have different levels of responsiveness to different wavelenghts of light.
Below shows how responsive each type of cone is to a specific wavelength of light.
Color Matching Function
The R,G, & B cones have different levels of responsiveness to different wavelenghts of light.
Below shows how responsive each type of cone is to a specific wavelength of light.
Jupyter Notebook of Color Fundamentals
"Naming" Colors
"Naming" Colors
"Naming" Colors
"Naming" Colors
"Naming" Colors: R,G,B Mapping
"Naming" Colors: R,G,B Mapping - Its limitations
 sRGB - graphics RGB |
 CIELAB - human RGB perception |
"Naming" Colors: HSV
(Cycle is though (1) H to change color, (2) S to change to grayscale, (3) V black to white)
"Naming" Colors: HSV
"Naming" Colors: Beyond HTML HEX - Specific Names
 HTML |
 matplotlib |
"Naming" Colors: Summary
- Color spaces
- HSV (Hue, saturation, value)
- CIELAB
- sRGB, Adobe sRGB
- RGB triplets, sometimes compressed into hexadecimel ("#00FFAA", etc)
- List of colors by name
Importance of Color
Which image has the red dot?
Importance of Color
Which image has the red dot?
Importance of Color
Which image has the red dot?
Importance of Color
Which image has the red dot?
Color maps = Visual Encoding
Color maps encode a data attribute as a color.
Color maps = Visual Encoding
Color maps encode a data attribute as a color.
Color maps = Visual Encoding
Color maps encode a data attribute as a color.
Color maps = Visual Encoding
Color maps encode a data attribute as a color.
Colormap
 |
Photo
 |
Color Palettes
Brewer, 1999
Ordered Colormaps

Historically, rainbows have been very popular.
Ordered Colormaps
Historically, rainbows have been very popular, but they can be misleading.
Ordered Colormaps
Historically, rainbows have been very popular, but they can be misleading.
"Fixes" to the rainbow colormap are only so-so.
Ordered: Sequential Colormaps


Diverging Colormaps


Ordered Colormaps
Combinations of color can pick out different features at different scales.
Qualitative Colormaps


Color Meaning

Color Meaning
Just for fun: It's full of colors
https://commons.wikimedia.org/wiki/File:16777216colors.png
Palette Mapping

Assign each value to a specific color or element.
Palette Mapping
Palette Mapping
Color Mapping: Normalizing Our Data
$f(v) \rightarrow (R, G, B)$
We can also re-map:
$f(v') \rightarrow (R, G, B)$
$v' = f(v)$
For instance, with logs or squares.
Color Mapping: Linear Normalization of Data
We map from a range of values to (0, 1):
$ v' = (v - v_0)/(v_1 - v_0) $
Color Mapping: RGB Components of Some Colormaps
Color Mapping: RGB Components of Some Colormaps
Color Mapping: RGB Components of Some Colormaps
Color Mapping: RGB Components of Some Colormaps
Color Mapping: RGB Components of Some Colormaps
Color Blindness
TOPIC 3: Other methods of visual encoding
Other methods of visual encoding
Motion is another channel, but is very attention-grabbing.
 Flicker |
 Velocity |
 Direction |
Check out sc2.ncsu.edu/faculty/healey/PP for more examples and research.
Intro to Programming & Data Viz
Jill P. Naiman
Summer 2020
Lecture 6