Fundamentals of Graphics

The Bedolina Map

The Bedolina Map

Actual Appearance

Champlain’s 1612 map of New France.

Jacques Barbeu-Dubourg carte chronologique. 1753

Joseph Priestly (1733-1804)

Priestley’s historical chart (1769)

J.H. Colton’s Stream of Time, 1842.

Link to Priestly on time

The standard charts

William Playfair?

Not William Playfair

North American Trade: Playfair, 1786

North American Trade: Playfair, 1786

Copperplate engraving

Copperplate engraving

This Chart is different from the others in principle, as it does not comprehend any portion of time, and it is much inferior in utility to those that do; for though it gives the extent of the different branches of trade, it does not compare the same branch of commerce with itself at different periods. . .”

(Playfair, 1786, p. 101, from Tufte, 1983, p. 33).

Playfair tries to explain the bar chart:

Suppose the money received by a man in trade were all in guineas,and that every evening he made a single pile of all the guineas received during that day, each pile would represent a day, and its height would be proportional to the receipts of that day; so that by this plain operation,time, proportion, and amount, would all be physically combined. Lineal arithmetic, then, it may be averred,is nothing more than those piles of guineas represented on paper.

Caption: Playfair’s Pie and Circle Charts, 1801

Galton’s “scatterplot”

The actual picture of Galton’s scatterplot.

19th Century: A golden age.

Guerry’s choropleths, 1820s

Snow’s map of the 1854 cholera epidemic.

Minard’s chart of Napoleon’s march on Russia.

A modern interpretation of Minard’s map.

Mulhall’s pictogram (1884)

The Dark Ages

Copperplate engraving

Copperplate engraving

The New Golden Age

Animation

Interactivity

The most Tuftean Boston charts you’ll see

http://mbtaviz.github.io/

Why R

Programming Languages

Programming Languages

Programming Languages

Programming Languages

Why do you choose a language?

  • Conformity with your team
  • Pre-existing libraries
  • Ease of maintenance
  • Ease of development
  • Speed

RStudio

Reading R Code

  1. Functions use names before parenthesis:
       instead of (log 5),
       log(5)
  1. Comments with the # sign
  1. Encourages literate programming.

Why R? It’s widely used in humanities and social sciences

  • But, WHY?
  • One useful data structure –the data frame.
  • Through libraries, a useful syntax for data processing.
  • Other libraries to do things in statistics, visualization, etc.

The tidyverse

  • A data-first, pipeline-based language for manipulating and

visualizing tabular data.

  • The tidyverse exists inside R, but is only a small (and recent) subset.
  • Most R packages for modeling also work on data frame objects.

Reading Racket code:

Functions evaluate from the inside out.


(* 3

  (- 1

    (/ 2

      (+ 1 7 )

    )

  )

)

Reading (tidy) R code:

The pipe operator (%>%) runs from left to right.


library(magrittr)


sum(1,7) %>% 

divide_by(2) %>%

subtract(1) %>%

multiply_by(3)

Advice on re-using code.

  1. Copy and paste, a lot.
  1. Check in with your neighbors.
  1. Change one part of the code at a time
  1. If you don’t break anything, you’re not trying hard enough.
  1. Google the errors.

What’s gone wrong?

  1. Are elements all closed? (Backticks on the markdown to make it grey; quotes; parentheses.)
  1. Have you run all the code above in the script?
  1. Is the ‘tidyverse’ package loaded?
  1. Find your neighbor?

Download: bostonography.benschmidt.org/rstudio.zip

Groups:

  1. What’s a dataset that should exist?

  2. Try and find it.