In-Class Exercise 6
Shih Chien University
2026-08-03
Plot the economics unemployment series (date vs unemploy) as a line. Using annotate(), add:
geom = "rect", with alpha) covering the years 2008–2010, andgeom = "text") near the rectangle reading "Financial crisis".Write one sentence on what the annotation immediately communicates to a reader that the bare line chart does not.
Take your scatterplot of displ vs hwy from mpg (coloured by class) and use labs() to add a descriptive title, a subtitle, axis labels with units (e.g., “Engine displacement (litres)”), and a caption crediting the data source (EPA, via the mpg dataset).
Write one sentence explaining why a caption naming the data source matters for a publication-ready figure.
Consider a line chart of txhousing median house prices over time for four cities, one coloured line per city. You can identify the lines either with a legend or with direct labels (text placed at the end of each line, e.g. via annotate() or geom_text() on a small summary dataset).
Sketch or code the direct-label version, then write two sentences on the trade-off: when is direct labelling clearer than a legend, and when does it break down (e.g., many overlapping series)?
Complete your answers in the official template from the Problem sets page (author = your student ID only; keep the UUID chunk). Knit to PDF, name it ex6-[StudentID].pdf, and upload it to the course pCloud folder before midnight of the following week.
ggplot2: Elegant Graphics for Data Analysis