screenshot from An Extremely Detailed Map of the 2016 Presidential Election by Matthew Bloch, Larry Buchanan, Josh Katz and Kevin Quealy (you will need a NYTimes.com account available through the library).

Grammar of graphics and the semiologie graphique

Bertin J. 1983. Semiology of graphics. Madison, WI: University of Wisconsin Press.

Wilkinson L. 2005. The Grammar of Graphics. 2nd ed. New York: Springer.

More recently refined in

Wickham H. 2010. A Layered Grammar of Graphics. Journal of Computational and Graphical Statistics 19(1):3–28.

Significantly, this has been implemented in R in the ggplot2 package (and related others), which... inspired tmap

image source boingboing.net

The idea

Graphical display = data + ‘aesthetic mappings’

An aesthetic mapping is a relation

data variable ↔ graphic variable

For example

quantity ↔ colour

image source medium.com/tdebeus by Thomas de Beus

image source medium.com/tdebeus by Thomas de Beus

## So the detailed version is ### graphic = ### data + ### aesthetics + ### shapes + ### facets + ### statistics + ### coordinates + ### themes
## In mapping we lose some control and are left with ### map = ### data + ### aesthetics + ### ~~shapes +~~ ### facets + ### statistics + ### ~~coordinates +~~ ### themes
## For our purposes for now, we work with ### map = ### data + ### aesthetics + ### ~~shapes +~~ ### ~~facets +~~ ### ~~statistics +~~ ### ~~coordinates +~~ ### ~~themes~~
# Finally then... ## In choropleth maps we focus on *how we translate from data to colour* ### What is the nature of our data? ### What kinds of translations are possible? ### What colour choices are available?

image source
commons.wikimedia.org
by Simon Eugster

Data scales

Different kinds of data are on different scales

Roughly speaking

Numeric

Ordinal

Categorical (or nominal)

Numeric

Values are numeric and differences and ratios are meaningful and comparable

In many situations a distinction is made between ratio and interval scales

These are the types of data we are most often concerned with in thematic mapping

image source starbuckssecretmenu.net

Ordinal

Data can be ordered, but not meaningfully compared in other ways

(small) < tall < grande < venti

XXS < XS < S < M < L < XL < XXL

image source commons.wikimedia.org
by Michael Johnson

Categorical (or nominal)

Difference in type, but no more than that

Land cover classes, ecosystem types, countries in a political map, etc.


I made this using the Dulux colours website...

image source commons.wikimedia.org by US federal government

An over-simplification...

So here’s some reading:

image from O’Sullivan D & DJ Unwin. 2010.
Geographic Information Analysis , Chapter 1.

# Choropleth maps ## A map of areas with values shown by _colour_ or _shading_ ## The aesthetic mapping is ### value ↔ colour ## Dependent on ### Data ### Colour palette ### Classification method or style

Colour

It’s complicated

image source
commons.wikimedia.org
by Fuzzypeg

Pre-cooked palettes

Cindy Brewer’s path-breaking work

See this brief item for the background

The viridis palettes have also become popular

Brewer palettes

Sequential

Brewer palettes

Diverging

Categorical

Viridis palettes

# Classification methods ## `style="equal"` ## `style="sd"` ## `style="quantile"` ## `style="cat"` ## `style="cont"` ## `breaks=c(...)`

Much more on this in the assignment

If there is now time... a demo

# Summary ## Choropleth maps an exemplar of grammar of graphics in practice ## Aesthetic mapping is value ↔ colour ## Many standard colour `palette`s available in `tmap` ## Also many classification `style`s ## Key is to pay attention to data distribution and message of the map