Skip to content
Prev 3207 / 15274 Next

Reply: layout options of barChart in quantmod

Dear Jeff,
I have just started to learn R yesterday.  Your instruction is so detailed that a fool as me could easily understand. :)    
I like R and R people.
Thanks again.

Wind

 
 
------------------ ???? ------------------
???: "Jeff Ryan"<jeff.a.ryan at gmail.com>;
????: 2008?11?13?(???) ??11:24
???: "?"<windspeedo at qq.com>; 
??: "r-sig-finance"<r-sig-finance at stat.math.ethz.ch>; 
??: Re: [R-SIG-Finance] layout options of barChart in quantmod

 
This should clarify (from a previous off-list exchange):

Before calling any chartSeries function (including barChart), use the
R 'layout' function. see ?layout
Each window is technically a plot region, so count the TA _windows_ when
you do this.

getSymbols("SPY;DIA;QQQQ;IWM")
layout(matrix(1:8, nrow=4), height=c(4,2.5,4,2.5))

Then set layout=NULL in each call.
chartSeries(IWM, layout=NULL)
chartSeries(SPY, layout=NULL)
chartSeries(DIA, layout=NULL)
chartSeries(QQQQ, layout=NULL)

You need to have a constant 'theme', or funny things will happen.


Other arrangements are possible, though require you to really get your
head around 'layout'.  I will one day be adding in a chartLayout tool
that will make this easier, but for now it is at least doable.

layout(matrix(c(1,1,1,2,3:6), nrow=4), height=c(4,2.5,4,2.5))
chartSeries(QQQQ, layout=NULL)
chartSeries(QQQQ, layout=NULL)
chartSeries(QQQQ, layout=NULL)

You won't be able to use this interactively once the chart is drawn
--- i.e. calling addTA to dynamically add TA additions.  The layout
needs to be calculated before any of the drawing takes place.  This is
what happens internally when you call addTA/chartSeries,, which is why
setting layout=NULL places the burden on you the user.

HTH,
Jeff
On Thu, Nov 13, 2008 at 8:11 AM, ? <windspeedo at qq.com> wrote: