Brianna Heggeseth
ggplot2
to create basic layers of graphicsVisualizations help us understand what we’re working with:
This understanding will inform our next steps:
Once our analysis is complete, visualizations are a powerful way to communicate our findings and tell a story.
In its original sense, in archaeology, a glyph is a carved symbol.
Heiroglyph | Mayan glyph |
---|---|
A data glyph is also a mark, e.g.
The features of a data glyph encodes the value of variables.
frame: The position scale describing how data are mapped to x and y
glyph: The basic graphical unit that represents one case (also know as a mark and symbol).
aesthetic: a visual property of a glyph such as position, size, shape, color, etc.
smoker -> color
color is black
facet: a subplot that shows one subset of the data
sex
by shape, we could split into two subplotsscale: A mapping that translates data values into aesthetics.
guide: An indication for the human viewer of the scale. This allows the viewer to translate aesthetics back into data values.
Each group will be assigned one NY Times graphics to look; list at the course website.
If you haven’t already, follow the instructions to gain access (paid by Macalester MCGS) to content at NYTimes.com.
For your assigned graphic, discuss the following seven questions with your partner(s):
Glyph-ready data has this form:
ggplot
Using the ggplot2
package, we can create graphics by building up layers, each of which may have its own data, glyphs, aesthetic mapping, etc.
The first layer just identifies the data set. It sets up a blank canvas, but does not actually plot anything:
Next, we add a geometry layer to identify the mapping of data to aesthetics for each of the glyphs:
Next, we can add some axes labels as guides:
We can change the scale of the color used for smoker status:
If instead we wanted to facet into columns based on smoker status, we could add another layer for that:
There’s no end to the number and type of visualizations you could make.
Continue on with the activity working through in the template Rmd.
Work with each other and support one another.
Get immediate feedback with the Solutions online.
Continue to work through the activity in the Rmd file.
You’ll submit a knitted html file of that template Rmd file for Assignment 2 (due next Tuesday).