According to my datas (cf. picture) called GDP. I would like to know how to plot a
If you use xts
to create timeseries data, you can use plot.xts
from xtsExtra
package to get desired result
#Uncomment below lines to install required packages
#install.packages("xts")
#install.packages("xtsExtra", repos="http://R-Forge.R-project.org")
library(xts)
library(xtsExtra)
head(data)
## ABC DEF
## 2007-01-03 83.80 467.59
## 2007-01-04 85.66 483.26
## 2007-01-05 85.05 487.19
## 2007-01-08 85.47 483.58
## 2007-01-09 92.57 485.50
## 2007-01-10 97.00 489.46
plot.xts(data, screens = factor(1, 1), auto.legend = TRUE)
You will get something like this
In case you want data in seperate panels:
plot.xts(data, auto.legend = TRUE)