I have a multivariate time series and would like to get a stacked area plot. How can this be done using ggplot2
?
The data could look likes this:
dates = as.Date(c("2015-04-07","2015-04-08","2015-04-09"))
stocks = xts(c(0.4,0.7,0.9),order.by = dates)
dates = as.Date(c("2015-04-07","2015-04-08","2015-04-09","2015-04-10"))
bonds = xts(c(0.6,0.3,0.1,1),order.by = dates)
example.data = merge(stocks,bonds)
I am quite new to ggplot. The data above is in long format. I have seen examples for wide format. How can I use the index of data for the x-axis without chaanging the data structure?