[Xts-commits] r659 - pkg/xtsExtra/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 2 18:41:52 CEST 2012


Author: weylandt
Date: 2012-07-02 18:41:52 +0200 (Mon, 02 Jul 2012)
New Revision: 659

Modified:
   pkg/xtsExtra/man/barplot.xts.Rd
Log:
Added examples to barplot.xts

Modified: pkg/xtsExtra/man/barplot.xts.Rd
===================================================================
--- pkg/xtsExtra/man/barplot.xts.Rd	2012-07-02 16:01:21 UTC (rev 658)
+++ pkg/xtsExtra/man/barplot.xts.Rd	2012-07-02 16:41:52 UTC (rev 659)
@@ -72,4 +72,31 @@
 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{Peter Carl with modifications by Michael Weylandt}
\ No newline at end of file
+\author{Peter Carl with modifications by Michael Weylandt}
+
+\examples{
+weights <- xts(matrix(runif(42, 0.1, 0.3), ncol = 6), as.yearmon(Sys.Date()) + 0:6)
+names(weights) <- paste("Factor", LETTERS[1:6])
+
+barplot(weights)
+
+# No legend
+barplot(weights, auto.legend = FALSE)
+
+# Not Stacked
+barplot(weights, stacked = FALSE)
+
+# Scale weights to sum to 1
+barplot(weights, scale = TRUE)
+
+# A nicer color pallette
+# rainbow6equal from Performance Analytics
+barplot(weights, scale = TRUE, col = c("#BF4D4D", "#BFBF4D", "#4DBF4D", "#4DBFBF","#4D4DBF", "#BF4DBF"))
+
+# Include negative data
+weights[,3] <- weights[,3] * -1
+
+barplot(weights)
+
+barplot(weights, stacked = FALSE)
+}



More information about the Xts-commits mailing list