[Xts-commits] r712 - in pkg/xtsExtra: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Aug 13 02:13:57 CEST 2012


Author: weylandt
Date: 2012-08-13 02:13:56 +0200 (Mon, 13 Aug 2012)
New Revision: 712

Modified:
   pkg/xtsExtra/R/plot.R
   pkg/xtsExtra/man/plot.xts.Rd
Log:
Recycle plot functions to allow even fancier charts like PA::charts.*

Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R	2012-08-09 23:55:49 UTC (rev 711)
+++ pkg/xtsExtra/R/plot.R	2012-08-13 00:13:56 UTC (rev 712)
@@ -114,8 +114,6 @@
     ylim <- screens[["ylim"]]
     screens <- screens[["screens"]]
     
-    panel <- match.fun(panel)
-    
     x.split <- split.xts.by.cols(x, screens)
     
     if(auto.legend) legend.names <- split(legend.names, screens)
@@ -138,6 +136,8 @@
       log.panel <- get.elm.from.dots("log", dots, screens, i)
       if(is.null(log.panel)) log.panel <- ""
       
+      panel.panel <- match.fun(if(length(panel) > 1L) get.elm.recycle(panel, i) else panel)
+      
       # Note that do_add.grid also sets up axes and what not
       do_add.grid(x.plot, major.ticks, major.format, minor.ticks, 
             auto.grid = auto.grid, ylab = ylab.panel, log = log.panel, 
@@ -146,7 +146,7 @@
             events = events, blocks = blocks,
             yax.loc = yax.loc, ylim = get.elm.recycle(ylim, i))
       
-      legend.pars.add <- do_add.lines(x.plot, panel = panel, col = col.panel, lwd = lwd.panel, 
+      legend.pars.add <- do_add.lines(x.plot, panel = panel.panel, col = col.panel, lwd = lwd.panel, 
                    pch = pch.panel, type = type.panel, cex = cex.panel, lty = lty.panel)
 
       if(auto.legend) do.call(do_add.legend, 

Modified: pkg/xtsExtra/man/plot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot.xts.Rd	2012-08-09 23:55:49 UTC (rev 711)
+++ pkg/xtsExtra/man/plot.xts.Rd	2012-08-13 00:13:56 UTC (rev 712)
@@ -34,7 +34,7 @@
   \item{xy.labels}{label points in scatterplot?}
   \item{xy.lines}{connect points in scatterplot?}
   \item{ylim}{How to handle \code{ylim} for plots. If \code{'fixed'} all panels share \code{ylim = range(x)}; if \code{'auto'} panels sharing a y axis have the same limits. If a numeric matrix, rows are recycled panel-wise as \code{ylim}.}
-  \item{panel}{A panel function for plotting; by default, \code{lines.xts}. Currently, is passed \code{col}, \code{pch}, \code{type}, \code{lwd}, \code{cex} by default so be prepared to handle these arguments, perhaps by receiving them via \code{...} and ignoring. If \code{panel != lines}, that is, if the user supplies a panel function, the first two arguments passed will be \code{as.POSIXct(index(z))} and \code{coredata(z)} where \code{z} is the series being plotted in that panel; as a result, note that any plotting inside \code{panel} requires \code{POSIXct}, regardless of the index class of \code{x}. Note further that \code{panel} is called for each series individually, even if they share a screen.}
+  \item{panel}{A panel function for plotting; by default, \code{lines.xts}. Currently, is passed \code{col}, \code{pch}, \code{type}, \code{lwd}, \code{cex} by default so be prepared to handle these arguments, perhaps by receiving them via \code{...} and ignoring. If \code{panel != lines}, that is, if the user supplies a panel function, the first two arguments passed will be \code{as.POSIXct(index(z))} and \code{coredata(z)} where \code{z} is the series being plotted in that panel; as a result, note that any plotting inside \code{panel} requires \code{POSIXct}, regardless of the index class of \code{x}. Note further that \code{panel} is called for each series individually, even if they share a screen. If a list of panel functions is passed, they are recycled panelwise (not serieswise).}
   \item{auto.legend}{Should a legend be added automatically?}
   \item{legend.names}{Names of series to be passed to the legend writing code. Should be one name per series plotted.}
   \item{legend.loc}{Location of legend: will be recycled panelwise.}



More information about the Xts-commits mailing list