Line and Path Plots

Want to learn more? I recommend working through: R for Data Science, R Cookbook, and R Graphics Cookbook.

Line plots is a path plot sorted by the x value

# load the ggplot2 library

# set the seed so we can reproduce the results
# plot a line plot with the date on the x axis and unemployment rate
qplot(date, unemploy / pop, data = economics, geom = "line")


# plot a line plot with the date being the x axis and the avg number of weeks unemployed on the y axis
qplot(date, uempmed, data = economics, geom = "line")