Ch03

Data Visualization.

The author of the epigraph at the start of the chapter is famous, you can read his mathematical obituary if you are interested.

The text suggests reading Wickham’s article that introduces the “Grammar of Graphics” ideas of ggplot2. I think this is a good idea.

FIXME: When do we read this? 03b-R-Explore-GrammarOfGraphics

3.2

In-class activity: the relationship between engine size and fuel efficiency.

According to ?mpg:

  • How large is the data set?
  • What variable describes the kind of drive train?
  • What values are allowed for the drive train variable?
  • Which variable describes the size of the engine? What units does it use?

More questions:

  • What does aes stand for in ggplot?
  • What is the purpose of the mapping argument to a geometry (geom) object?

3.3 Aesthetics with Exercises

  • What is an aesthetic?
  • Aside from x and y, give three examples of aesthetic properties.
  • What is the difference between shape 15 (a square) and shape 22 (a square)?
  • Do the exercises 1-6 in Section 3.3.1. The point brought up in exercise 1 is kind of subtle - we should discuss it in class. Write down at least one sentence to say about it.

Note: If you are trying to read more, say the vignette about the ggplot specs, including the stroke aesthetic, just search for the topic online. Right now, it looks like the Colaboratory does not have a good way to access the vignette command.

3.5 Facets with Exercises

There are six exercises in this section. Do them all.

Make predictions before you run code, write them down first, then if you were wrong explain something you learned or still wonder about.

Q4: Also make the plot using color instead of faceting.

3.6 Geometric objects (geoms)

  • Name three different kinds of geoms. (Two are easy to find in the text.)
  • How do you get two different representations (geoms) to show in the same plot?
  • How do you avoid repeating the assignments of variables to the x and y coordinates when you are showing multiple geometries in one graph?
  • Bonus: What can you do if you are only interested in graphing a line through the four cylinder vehicles?

There are six exercises in this section. Do them all.

Q5: As usual, write your prediction and explanation before checking by running the code. If you learn something, add another sentence explaining your new understanding.

Q6: Making these graphs is a fundamental learning experience!

3.7 Statistics

  • What is the relationship between a geometry and a statistic?
Last modified August 18, 2023: 2022-2023 End State (7352e87)