---
title: "Data visualization exercises"
author: "Nicholas Horton (nhorton@amherst.edu)"
date: "August 31, 2017"
output:
  html_document:
    fig_height: 5
    fig_width: 7
  pdf_document:
    fig_height: 5
    fig_width: 7
  word_document:
    fig_height: 3
    fig_width: 5
---

```{r, setup, include=FALSE}
library(mdsr)   # Load additional packages here 


# Some customization.  You can alter or delete as desired (if you know what you are doing).
trellis.par.set(theme=theme.mosaic()) # change default color scheme for lattice
knitr::opts_chunk$set(
  tidy=FALSE,     # display code as typed
  size="small")   # slightly smaller font for code
```

## Introduction
These exercises are taken from the data visualization chapter from **Modern Data Science with R**: http://mdsr-book.github.io.  Other materials relevant for instructors (sample activities, overview video) for this chapter can be found there.

## Cartesian plot
What would a Cartesian plot that used colors to convey categorical values look like?

SOLUTION:



## NY Times
Consider the two graphics related to *The New York Times*  "Taxmageddon" article at http://www.nytimes.com/2012/04/15/sunday-review/coming-soon-taxmageddon.html. The first is http://www.nytimes.com/imagepages/2012/04/13/opinion/sunday/0415web-leonhardt.html (whose tax rates rose and fell) and the second is http://www.nytimes.com/imagepages/2012/04/13/opinion/sunday/0415web-leonhardt2.html (who gains most from tax breaks).

1.  Examine the two graphics carefully. Discuss what you think they convey. What story do the graphics tell?
2.  Evaluate both graphics in terms of the taxonomy described in this chapter. Are the scales appropriate? Consistent? Clearly labelled? Do variable dimensions exceed data dimensions?
3. What, if anything, is misleading about these graphics?

SOLUTION:

## Graphical critique
Choose *one* of the data graphics listed at http://mdsr-book.github.io/exercises.html#exercise_23
and answer the following questions. Be sure to indicate which graphical display you picked.

1. Identify the visual cues, coordinate system, and scale(s).
2. How many variables are depicted in the graphic? Explicitly link each variable to a visual cue that you listed above.
3. Critique this data graphic using the taxonomy described in this chapter.

SOLUTION:

## Design choice
Answer the following questions for each of the following collections of data graphics listed at http://mdsr-book.github.io/exercises.html#exercise_24.  Briefly (one paragraph) critique the designer's choices. Would you have made different choices? Why or why not?

Note: Each link contains a collection of many data graphics, and we don't expect (or want) you to write a dissertation on each individual graphic. But each collection shares some common stylistic elements. You should comment on a few things that you notice about the design of the collection.


## Telling stories
Consider one of the more complicated data graphics listed at http://mdsr-book.github.io/exercises.html#exercise_25.

1. What story does the data graphic tell? What is the main message that you take away from it?
2. Can the data graphic be described in terms of the taxonomy presented in this chapter? If so, list the visual cues, coordinate system, and scales(s) as you did in Problem 2(a). If not, describe the feature of this data graphic that lies outside of that taxonomy.
3. Critique and/or praise the visualization choices made by the designer. Do they work? Are they misleading? Thought-provoking? Brilliant? Are there things that you would have done differently? Justify your response.

## Unplanned
Consider the data graphic http://tinyurl.com/nytimes-unplanned about birth control methods.

1. What quantity is being shown on the $y$-axis of each plot?
2. List the variables displayed in the data graphic, along with the units and a few typical values for each.
3. List the visual cues used in the data graphic and explain how each visual cue is linked to each variable.
4. Examine the graphic carefully. Describe, in words, what *information* you think the data graphic conveys. Do not just summarize the *data*: interpret the data in the context of the problem and tell us what it means.
