The last question of this semester, I promise. How can I make a ggplot2 showing all three of these stocks?
library(quantmod)
library(ggplot2)
library(magrittr)
library(broom)
start = as.Date("2014-02-01")
end = as.Date("2020-03-31")
getSymbols(c("JPM", "C", "WFC"), src = "yahoo",
from = start, to = end)
head(WFC)
stocks = as.xts(data.frame(C = C[, "C.Adjusted"], JPM = JPM[, "JPM.Adjusted"], WFC = WFC[, "WFC.Adjusted"]))
names(stocks) = c("Citi", "JP Morgan", "Wells Fargo")
index(stocks) = as.Date(index(stocks))
I am supposed to make two graphs in two different colors themes and all three stocks must be on the same graph, but I am stuck here:
stocks_series = tidy(stocks) %>%
ggplot(aes(x=index,y=value, color=series)) + geom_line()