## 13.1 Line vs. path plots

• Line and path plots typically used for time series data
• Line plots: join the points from left to right
• Have time on the x-axis, showing how a single variable has changed over time
• Path plots: join them in the order that they appear in the dataset (in other words, a line plot is a path plot of the datasorted by x value)
• show how two variables have simultaneously changed over time, with time encoded in the way that observations are connected
• Figure 13.1 and ?? show unemployment over time. Figure 13.1 shows the unemployment rate while Figure 13.2 shows the median number of weeks unemployed.
ggplot(economics, aes(date, unemploy / pop)) + geom_line()
ggplot(economics, aes(date, uempmed)) + geom_line()
• Unemployment rate vs. length of unemployment
• Figure ?? plots unemployment rate vs. length of unemployment and join the individual observations with a path
• The additinoal color makes it easier to grasp time
ggplot(economics,aes(unemploy / pop, uempmed)) +
geom_path() +
geom_point()
year <- function(x)as.POSIXlt(x)\$year + 1900

ggplot(economics,aes(unemploy / pop, uempmed)) +
geom_path(colour ="grey50") +
geom_point(aes(colour =year(date)))