[R-SIG-Finance] Multiple quantmod charts on one plot ?

Jeff Ryan jeff.a.ryan at gmail.com
Tue Apr 20 17:03:15 CEST 2010

Hi Ulrich,

One of the weaknesses to the original quantmod charts is the
difficulty in layout.

The (very dated) examples on the site are made by carefully managing
the layout (final expected layout) with the R function... 'layout'.

Search the list for some examples of how to do this, but suffice it to
say here that the answer revolves around 'layout' and passing
layout=NULL to the charting calls.

The newest R-forge version fixes all of this.  The code you have below
is essentially how you would use the new version, though lineChart and
co. are not yet available as wrappers.

chart_Series and add_TA will get most of what you want done, and
feedback is appreciated as I hope to get this to CRAN now that the
R/Finance conference is over.

Eventually the names will move back to the old chartSeries etc
convention, but for now to keep some sanity in old code, I will
provide both old and new functionality.


On Tue, Apr 20, 2010 at 9:53 AM, Ulrich Staudinger
<ustaudinger at gmail.com> wrote:
> Hi there,
> I try to replicate the nice chart on http://www.quantmod.com/gallery/, but
> am stuck at putting several charts onto one plot.
> In traditional R, I would do:
> par(mfrow=c(2,1))
> plot(data1)
> plot(data2)
> ... but with quantmod, when I:
> par(mfrow=c(2,1))
> lineChart(data1)
> lineChart(data2)
> then I see only the line chart of data2.
> What do I have to use to put several line/candle/barcharts onto one plot
> pane?
> Thanks!
> --
> Kind regards,
> Ulrich B. Staudinger
>        [[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.
> -- Also note that this is not the r-help list where general R questions should go.

Jeffrey Ryan
jeffrey.ryan at insightalgo.com

ia: insight algorithmics

More information about the R-SIG-Finance mailing list