Skip to content

quantmod - chart object (chob)

5 messages · Hungte (Stanley) Chu, Brian G. Peterson, Jeff Ryan +1 more

#
Hi everyone, 

I am curious that if I can collect a list of chob objects and later tile these plots in a pdf file. I have a function to handle this for r plot objects, but I am having trouble with chob. In simple words, print(chob) does not work. Can anyone point me a direction? 

Thanks,
Stanley
#
Using layout() is possible with the newer chart_Series, but not with the
older chartSeries.  The chob objects are different too, and not easy to
manipulate.
On Fri, 2011-06-17 at 21:38 +0400, Hungte (Stanley) Chu wrote:
1 day later
#
Stanley,

As Brian replied - you _can_ - but the trick is to use the new version
"chart_Series".  This creates single drawings with multiple 'panes'
all within what R *thinks* is a single graphic - whereas the old code
relied on layout internally - so was very difficult to use layout with
an existing layout.

It isn't very easy to build up a list to be plotted later though,
should be workable I suppose - I just haven't tried or needed I guess.

Best,
Jeff
On Fri, Jun 17, 2011 at 12:38 PM, Hungte (Stanley) Chu <chd850 at gmail.com> wrote:

  
    
#
Hi Jeff & Brian,

Thanks for the reply. 

The idea is to be able to save the plot object for future reference, with minimal work to reproduce it, and to be able to use them freely in a document. For example, one may be able to use a viewport function to specify the layout. 
e.g. vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y), and use print(plot.list, vp = vplayout(x, y)) to place them in a document. Given a list of plot objects and defined "position" for each plot, the function should be able to render them accordingly in a document. 

I can probably use dev.copy2pdf and manually tile them, so no biggie. Thanks Jeff for your wonderful package(s). 


Thanks,
Stanley
On Jun 19, 2011, at 6:48 PM, Jeffrey Ryan wrote:

            
#
One item to note - they are built with a custom tool built for
quantmod called 'replot'.  Essentially is a layout tool to align the x
(time) axis, but using base graphics (not grid).

Mixing traditional graphics and grid is really not easy - and grid is
really, really slow (see ggplot2) - so you probably will have a hard
time with the approach you are thinking of.  Luckily nothing is
impossible - so if you have success, please share your results!!

Best,
Jeff
On Sun, Jun 19, 2011 at 10:49 AM, Stanley Chu <chd850 at gmail.com> wrote: