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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 14 18:15:41 CEST 2012


Author: weylandt
Date: 2012-08-14 18:15:41 +0200 (Tue, 14 Aug 2012)
New Revision: 715

Modified:
   pkg/xtsExtra/R/plot.R
   pkg/xtsExtra/man/plot.xts.Rd
Log:
Allow legend to be skipped for certain panels

Modified: pkg/xtsExtra/R/plot.R
===================================================================
--- pkg/xtsExtra/R/plot.R	2012-08-14 06:36:06 UTC (rev 714)
+++ pkg/xtsExtra/R/plot.R	2012-08-14 16:15:41 UTC (rev 715)
@@ -149,8 +149,8 @@
       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, 
-                  c(legend.names = list(legend.names[[i]]), 
+      if(auto.legend && !is.na(get.elm.recycle(legend.loc,i)))
+        do.call(do_add.legend, c(legend.names = list(legend.names[[i]]), 
                     legend.loc = get.elm.recycle(legend.loc, i), 
                     legend.pars.add, legend.pars))
     }

Modified: pkg/xtsExtra/man/plot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot.xts.Rd	2012-08-14 06:36:06 UTC (rev 714)
+++ pkg/xtsExtra/man/plot.xts.Rd	2012-08-14 16:15:41 UTC (rev 715)
@@ -37,7 +37,7 @@
   \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.}
+  \item{legend.loc}{Location of legend: will be recycled panelwise. If \code{NA}, a legend is ommitted for that panel}
   \item{legend.pars}{Additional arguments, passed as a list, to be passed to \code{legend}. Will not recycle}
   \item{events}{A list with mandatory elements \code{time} and \code{label} and optional 
   elements \code{col} and \code{lty} giving the events to be highlighted. See examples.}



More information about the Xts-commits mailing list