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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 2 18:01:21 CEST 2012


Author: weylandt
Date: 2012-07-02 18:01:21 +0200 (Mon, 02 Jul 2012)
New Revision: 658

Modified:
   pkg/xtsExtra/NAMESPACE
   pkg/xtsExtra/R/barplot.R
   pkg/xtsExtra/man/barplot.xts.Rd
Log:
Exported barplot.xts and wrote basic man page.

Modified: pkg/xtsExtra/NAMESPACE
===================================================================
--- pkg/xtsExtra/NAMESPACE	2012-07-02 15:43:57 UTC (rev 657)
+++ pkg/xtsExtra/NAMESPACE	2012-07-02 16:01:21 UTC (rev 658)
@@ -1,8 +1,16 @@
+# WHY DON'T DEPENDENCIES COVER THESE IMPORTS? 
+import(stats)
+import(utils)
+import(graphics)
+import(xts)
+import(zoo)
+
 ## Graphics
 
 export("plot.xts")
-# export("barplot.xts") -- Not yet ready
+export("barplot.xts")
 S3method(plot, xts)
+S3method(barplot, xts)
 
 ## Analytics
 
@@ -35,11 +43,6 @@
 S3method(stl, default)
 S3method(stl, xts)
 
-# WHY DON'T DEPENDENCIES COVER THESE IMPORTS? 
-import(stats)
-import(utils)
-import(xts)
-import(zoo)
 
 ## Data frame capability
 S3method(Ops, xtsdf)

Modified: pkg/xtsExtra/R/barplot.R
===================================================================
--- pkg/xtsExtra/R/barplot.R	2012-07-02 15:43:57 UTC (rev 657)
+++ pkg/xtsExtra/R/barplot.R	2012-07-02 16:01:21 UTC (rev 658)
@@ -23,7 +23,7 @@
                         cex.legend = 0.8, cex.lab = 1, cex.labels = 0.8, cex.main = 1,
                         xaxis=TRUE, element.color = "darkgray", xlab="Date",
                         ylab="Value", major.ticks='auto', minor.ticks=TRUE,
-                        las = 0, xaxis.labels = NULL, col = NULL, ...) {
+                        las = 3, xaxis.labels = NULL, col = NULL, ...) {
   # Don't like this name for input variable, 
   # but we must match S3 generic so we'll just change it
   x = height 
@@ -133,13 +133,10 @@
     
     do_barplot.legend("center", legend=colnames(x), cex = cex.legend, fill=col, ncol=ncol, box.col=element.color, border.col = element.color)
   }
+  assign(".barplot.xts",recordPlot(),.GlobalEnv)
   invisible(height)
 }
 
-do_unstacked.barplot <- function(){
-  
-}
-
 do_barplot.legend <- function (x, y = NULL, legend, fill = NULL, col = par("col"),
                                lty, lwd, pch, angle = 45, density = NULL, bty = "o", bg = par("bg"),
                                pt.bg = NA, cex = 1, pt.cex = cex, pt.lwd = lwd, xjust = 0,

Modified: pkg/xtsExtra/man/barplot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/barplot.xts.Rd	2012-07-02 15:43:57 UTC (rev 657)
+++ pkg/xtsExtra/man/barplot.xts.Rd	2012-07-02 16:01:21 UTC (rev 658)
@@ -1,18 +1,75 @@
 \name{barplot.xts}
 \alias{barplot.xts}
-\title{ Time-Oriented Barplots from xts Objects }
+\title{Time-Oriented Barplots from xts Objects}
 \description{A barplot method for xts objects.}
 \usage{
-\method{barplot}{xts}(height, stacked = TRUE, scale = FALSE, ...)
+\method{barplot}{xts}(height, stacked = TRUE, scale = FALSE, auto.legend = TRUE, 
+                        date.format = '\%b \%y', ylim=NULL, space = 0.2, cex.axis=0.8,
+                        cex.legend = 0.8, cex.lab = 1, cex.labels = 0.8, cex.main = 1,
+                        xaxis=TRUE, element.color = "darkgray", xlab="Date",
+                        ylab="Value", major.ticks='auto', minor.ticks=TRUE,
+                        las = 3, xaxis.labels = NULL, col = NULL, ...)
 }
 \arguments{
-  \item{height}{ an \code{xts} object of desired frequency. Use \code{to.period} functions to aggregate data outside of \code{barplot}.}
+  \item{height}{An \code{xts} object of desired frequency. Use \code{to.period}
+  functions to aggregate data outside of \code{barplot}.}
   \item{stacked}{logical. Should barplot be stacked?}
-  \item{scale}{logical. Should data be rescaled to sum to 100\% at each bar? Currently does not support negative values.}
-  \item{\dots}{ additional graphical arguments }
+  \item{scale}{logical. Should data be rescaled to sum to 100\% at each bar? 
+  Currently does not support negative values.}
+  \item{auto.legend}{logical. Should a legend be placed underneath the barplot?}
+  \item{date.format}{Format string for x-axis time labels.}
+  \item{ylim}{Limits of y-axis. If \code{NULL}, sensible defaults are chosen.}
+  \item{space}{the amount of space (as a fraction of the
+  average bar width) left before each bar, as in
+  \code{\link{barplot}}. Default is 0.2.}
+  
+  \item{cex.axis}{The magnification to be used for sizing
+  the axis text relative to the current setting of 'cex',
+  similar to \code{\link{plot}}.}
+  
+  \item{cex.legend}{The magnification to be used for sizing
+  the legend relative to the current setting of 'cex',
+  similar to \code{\link{plot}}.}
+
+  \item{cex.labels}{The magnification to be used for event
+  line labels relative to the current setting of 'cex'.}
+
+  \item{cex.lab}{The magnification to be used for x- and
+  y-axis labels relative to the current setting of 'cex'.}
+
+  \item{cex.main}{The magnification to be used for the
+  chart title relative to the current setting of 'cex'.}
+
+  \item{xaxis}{If true, draws the x axis}
+  
+  \item{element.color}{provides the color for drawing
+  less-important chart elements, such as the box lines,
+  axis lines, etc.}
+
+  \item{xlab}{the x-axis label, which defaults to 'NULL'.}
+
+  \item{ylab}{Set the y-axis label, same as in
+  \code{\link{plot}}}
+
+  \item{major.ticks}{Should major tickmarks be drawn and
+  labeled, default 'auto'}
+
+  \item{minor.ticks}{Should minor tickmarks be drawn,
+  default TRUE}
+  
+  \item{las}{Sets orientation of axis labels, as described in \code{\link{par}}. 
+  Here defalts to 3}
+
+  \item{xaxis.labels}{Allows for non-date labeling of date
+  axes, default is NULL}
+
+  \item{col}{Color of bars. Defaults to a bright color pallette rather than the
+  grays that are the default of other \code{baplot} methods.}
+
+  \item{\dots}{ additional graphical arguments passed to \code{\link{barplot}}.}
 }
 \details{
 Used to provide time-oriented barplots. 
 }
 \value{Invisibly returns the plotted object. Also assigns \code{.barplot.xts} to \code{.GlobalEnv} which can be used to "replay" the plot.}
-\author{ Michael Weylandt using code by P. Carl and B. Peterson}
\ No newline at end of file
+\author{Peter Carl with modifications by Michael Weylandt}
\ No newline at end of file



More information about the Xts-commits mailing list