I have been trying to plot 4 candlestick charts in one plot. The grid.arrange, layout or par() function didn't work. I have tried the following code as well
m1 <- tail(merck.xts, n = 32)
head(merck.xts)
Open High Low Close Adj.Close
2019-09-04 "87.14" "87.17" "85.420" "86.05" "83.54009"
2019-09-05 "86.64" "86.66" "85.500" "86.10" "83.58862"
2019-09-06 "86.54" "86.93" "86.310" "86.57" "84.04491"
2019-09-09 "86.50" "86.52" "82.920" "83.47" "81.03533"
2019-09-10 "82.39" "82.39" "78.850" "81.69" "79.30725"
2019-09-11 "81.86" "83.11" "81.620" "82.92" "80.50137"
dy_graph <- list(
dygraphs::dygraph(m1, group="Indicator", main="Merck"),
dygraphs::dygraph(m2, group="indicator", main="Pfizer")
)
dy_candlestick<-dyCandlestick(dy_graph)
htmltools::browsable(htmltools::tagList(dy_candlestick))
The problem with this code is that it brings the 2 charts in one single plot but shows no candlesticks
There are two more candlestick charts but as well m3 and m4. If someone could answer that would be very useful. Thanks in advance
Your time series matrix looks odd for me. It seems to be all characters. You can get it to work by using the example dataset, note and check that you have numeric and not characters: