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
library(ggplot2)

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

png

# 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")

png