R/quantmod: multiple charts all using the same y-axis

后端 未结 2 1052
一向
一向 2020-12-15 12:38

I\'m trying to plot 6 days of intraday data as 6 charts. Quantmod\'s experimental chart_Series() function works with par() settings. I\'ve pre-loaded the data into bar

2条回答
  •  离开以前
    2020-12-15 13:04

    Googling to understand Vincent's answer led me to the layout() command. It seems incompatible with par(mfrow), but some more experimentation found it can be used as an alternative.

    ylim=c(18000,20000)
    layout(matrix(1:12,nrow=6,ncol=2), height=c(4,2,4,2,4,2))
    for(d in bars){
        chartSeries(d,layout=NULL,TA=c(addVo(),addBBands()),yrange=ylim)
        }
    

    (You'll notice I added bollinger bands too, to be sure overlays still work too.)

提交回复
热议问题