Skip to content

Instantly share code, notes, and snippets.

@tengpeng
Last active October 28, 2016 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tengpeng/eabf0135e4e4a517a925cb27fbe00870 to your computer and use it in GitHub Desktop.
Save tengpeng/eabf0135e4e4a517a925cb27fbe00870 to your computer and use it in GitHub Desktop.
Combine two ggplots into one
# Original two
ggplot(US_Propane_Weekly, aes(as.Date(date), value)) + geom_line() + xlab("date") + ggtitle("US_Propane_Weekly")
ggplot(Iowa_Propane_Monthly, aes(as.Date(date), value)) + geom_line() + xlab("date") + ggtitle("Iowa_Propane_Monthly")
# Combine into one
p = ggplot(US_Propane_Weekly, aes(as.Date(date), value)) + geom_line() + xlab("date") + ggtitle("US_Propane_Weekly vs. Iowa_Propane_Monthly")
p = p + geom_line(data = Iowa, aes(as.Date(date), value), colour="red")
p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment