Last active
January 15, 2016 08:46
-
-
Save leondutoit/52240ead33aaaf064783 to your computer and use it in GitHub Desktop.
multiple timeseries ggplot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install dependencies | |
options(repos = 'https://cran.rstudio.com/') | |
install.packages('ggplot2') | |
# read example data | |
data <- read.csv('tsdata.csv', colClasses = c('Date', 'numeric', 'character'), stringsAsFactors = FALSE) | |
# load library and make a timeseries plot | |
library(ggplot2) | |
ggplot(data, aes(date, val, colour=label)) + geom_line() | |
# for more plot customisation see: http://docs.ggplot2.org/current/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date | val | label | |
---|---|---|---|
2016-01-01 | 44 | a | |
2016-01-01 | 66 | b | |
2016-01-02 | 23 | a | |
2016-01-02 | 21 | b | |
2016-01-03 | 32 | a | |
2016-01-03 | 29 | b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment