[R-SIG-Finance] trying to plot coincident time series in quantmod...
Jeff Ryan
jeff.a.ryan at gmail.com
Thu May 14 16:24:08 CEST 2009
Hi Eugene,
addPoints isn't very useful. I intend on adding wrapper functions to
the underlying base graphics functions in R, that will work with
quantmod. Until then 'addTA' will do almost everything you would want
for simple additions.
Both of these work:
addTA(dat_[,'5x16'],type='p',col='red',pch=25,on=1)
addTA(dat_[,'7x24'],type='p',col='red',pch=25,on=1)
Key points:
** Don't convert dat_ from xts. The timestamps are important.
** the "on" argument is where to draw. In this case "1" is the main
window you want.
HTH
Jeff
On Thu, May 14, 2009 at 8:35 AM, Eugene Tyurin <etyurin at skipstonellc.com> wrote:
> Hello!
>
> I am trying to plot more than one time series on one chart using quantmod's
> functions. However, my ability to parse the source code is lacking...
>
> For the life of me I can't figure out a way to use addPoints(). Simple
> points() function breaks down due to na.omit() in chartSeries().
>
> What is the "proper way" to do something like this? I attached a simple
> example below:
>
> ix<-as.Date('2009-05-01')+seq(0,6)
> dat_<-xts(cbind(sin(1:7),sin(1:7)),order.by=ix)
> colnames(dat_)<-c('7x24','5x16')
> dat_[2:3,'5x16']<-NA
>
> # This works fine:
> lineChart(dat_[,'7x24'])
> points(as.vector(dat_[,'5x16']),col='red',type='p',pch=25)
>
> # This does not:
> lineChart(dat_[,'5x16'])
> points(as.vector(dat_[,'7x24']),col='red',type='p',pch=25)
>
> Thanks!
> -- Eugene Tyurin.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
--
Jeffrey Ryan
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
www.insightalgo.com
More information about the R-SIG-Finance
mailing list