[Xts-commits] r847 - in pkg/xtsExtra: R man sandbox
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 10 00:38:15 CEST 2014
Author: rossbennett34
Date: 2014-09-10 00:38:14 +0200 (Wed, 10 Sep 2014)
New Revision: 847
Added:
pkg/xtsExtra/man/plot2_xts.Rd
Modified:
pkg/xtsExtra/R/plot2.R
pkg/xtsExtra/sandbox/test_plot2.R
Log:
adding first draft of help file for plot2
Modified: pkg/xtsExtra/R/plot2.R
===================================================================
--- pkg/xtsExtra/R/plot2.R 2014-09-08 23:53:44 UTC (rev 846)
+++ pkg/xtsExtra/R/plot2.R 2014-09-09 22:38:14 UTC (rev 847)
@@ -171,6 +171,54 @@
theme
}
+#' Time series Plotting
+#'
+#' Plotting for xts objects.
+#' TODO: description, details, and examples
+#'
+#' @param x xts object
+#' @param y NULL, not used
+#' @param \dots any passthrough parameters to FUN
+#' @param subset character vector of length one of the subset range using subsetting as in \code{\link{xts}}
+#' @param FUN function to apply to \code{x} and plot
+#' @param panels character vector of expressions to plot as panels
+#' @param multi.panel TRUE/FALSE or an integer less than or equal to the number
+#' of columns in the data set. If TRUE, each column of the data is plotted in a
+#' separate panel. For example, if \code{multi.panel = 2}, then the data
+#' will be plotted in groups of 2 columns and each group is plotted in a
+#' separate panel.
+#' @param colorset color palette to use, set by default to rational choices
+#' @param up.col color for positive bars if \code{type="h"}
+#' @param dn.col color for positive bars if \code{type="h"}
+#' @param type the type of plot to be drawn, same as in \code{\link{plot}}
+#' @param lty set the line type, same as in plot
+#' @param lwd set the line width, same as in plot
+#' @param lend set the line end style, same as in plot
+#' @param main main title
+#' @param clev level for shading, not currently used
+#' @param cex not currently used
+#' @param cex.axis
+#' @param mar set the margins, same as in par
+#' @param srt rotation for the y axis labels
+#' @param xaxis.las rotation for the x axis labels
+#' @param ylim the range of the y axis
+#' @param yaxis.same TRUE/FALSE. If TRUE, the y axis is drawn with the same ylim for multiple panels
+#' @param yaxis.left if TRUE, draws the y axis on the left
+#' @param yaxis.right if TRUE, draws the y axis on the right
+#' @param grid.ticks.on period to draw the grid ticks on
+#' @param grid.ticks.lwd line width of the grid
+#' @param grid.ticks.lty line type of the grid
+#' @param grid.col color of the grid
+#' @param labels.col color of the axis labels
+#' @param format.labels not currently used
+#' @param shading not currently used
+#' @param bg.col not currently used
+#' @param grid2 color for secondary x axis grid
+#' @param legend.loc places a legend into one of nine locations on the chart:
+#' bottomright, bottom, bottomleft, left, topleft, top, topright, right, or
+#' center. Default NULL does not draw a legend.
+#'
+#'
plot2_xts <- function(x,
y=NULL,
...,
Added: pkg/xtsExtra/man/plot2_xts.Rd
===================================================================
--- pkg/xtsExtra/man/plot2_xts.Rd (rev 0)
+++ pkg/xtsExtra/man/plot2_xts.Rd 2014-09-09 22:38:14 UTC (rev 847)
@@ -0,0 +1,97 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{plot2_xts}
+\alias{plot2_xts}
+\title{Time series Plotting}
+\usage{
+plot2_xts(x, y = NULL, ..., subset = "", FUN = NULL, panels = NULL,
+ multi.panel = FALSE, colorset = 1:12, up.col = "green",
+ dn.col = "red", type = "l", lty = 1, lwd = 2, lend = 1,
+ main = deparse(substitute(x)), clev = 0, cex = 0.6, cex.axis = 0.9,
+ mar = c(3, 2, 0, 2), srt = 0, xaxis.las = 0, ylim = NULL,
+ yaxis.same = TRUE, yaxis.left = TRUE, yaxis.right = TRUE,
+ grid.ticks.on = "months", grid.ticks.lwd = 1, grid.ticks.lty = 1,
+ grid.col = "darkgray", labels.col = "#333333", format.labels = TRUE,
+ shading = 1, bg.col = "#FFFFFF", grid2 = "#F5F5F5", legend.loc = NULL)
+}
+\arguments{
+\item{x}{xts object}
+
+\item{y}{NULL, not used}
+
+\item{\dots}{any passthrough parameters to FUN}
+
+\item{subset}{character vector of length one of the subset range using subsetting as in \code{\link{xts}}}
+
+\item{FUN}{function to apply to \code{x} and plot}
+
+\item{panels}{character vector of expressions to plot as panels}
+
+\item{multi.panel}{TRUE/FALSE or an integer less than or equal to the number
+of columns in the data set. If TRUE, each column of the data is plotted in a
+separate panel. For example, if \code{multi.panel = 2}, then the data
+will be plotted in groups of 2 columns and each group is plotted in a
+separate panel.}
+
+\item{colorset}{color palette to use, set by default to rational choices}
+
+\item{up.col}{color for positive bars if \code{type="h"}}
+
+\item{dn.col}{color for positive bars if \code{type="h"}}
+
+\item{type}{the type of plot to be drawn, same as in \code{\link{plot}}}
+
+\item{lty}{set the line type, same as in plot}
+
+\item{lwd}{set the line width, same as in plot}
+
+\item{lend}{set the line end style, same as in plot}
+
+\item{main}{main title}
+
+\item{clev}{level for shading, not currently used}
+
+\item{cex}{not currently used}
+
+\item{cex.axis}{}
+
+\item{mar}{set the margins, same as in par}
+
+\item{srt}{rotation for the y axis labels}
+
+\item{xaxis.las}{rotation for the x axis labels}
+
+\item{ylim}{the range of the y axis}
+
+\item{yaxis.same}{TRUE/FALSE. If TRUE, the y axis is drawn with the same ylim for multiple panels}
+
+\item{yaxis.left}{if TRUE, draws the y axis on the left}
+
+\item{yaxis.right}{if TRUE, draws the y axis on the right}
+
+\item{grid.ticks.on}{period to draw the grid ticks on}
+
+\item{grid.ticks.lwd}{line width of the grid}
+
+\item{grid.ticks.lty}{line type of the grid}
+
+\item{grid.col}{color of the grid}
+
+\item{labels.col}{color of the axis labels}
+
+\item{format.labels}{not currently used}
+
+\item{shading}{not currently used}
+
+\item{bg.col}{not currently used}
+
+\item{grid2}{color for secondary x axis grid}
+
+\item{legend.loc}{places a legend into one of nine locations on the chart:
+bottomright, bottom, bottomleft, left, topleft, top, topright, right, or
+center. Default NULL does not draw a legend.}
+}
+\description{
+Plotting for xts objects.
+TODO: description, details, and examples
+}
+
Modified: pkg/xtsExtra/sandbox/test_plot2.R
===================================================================
--- pkg/xtsExtra/sandbox/test_plot2.R 2014-09-08 23:53:44 UTC (rev 846)
+++ pkg/xtsExtra/sandbox/test_plot2.R 2014-09-09 22:38:14 UTC (rev 847)
@@ -11,8 +11,10 @@
# assign to a variable and then print it results in a plot
x <- plot2_xts(R)
+y <- addReturns()
+x
class(x)
-x
+y
# small multiples, line plot of each column
plot2_xts(R, multi.panel=TRUE)
@@ -35,7 +37,7 @@
plot2_xts(R, multi.panel=TRUE, type="h")
# Replicate charts.PerformanceSummary
-plot2_xts(R, FUN="CumReturns")
+plot2_xts(R, FUN=CumReturns)
addReturns(type="h")
addDrawdowns()
@@ -43,8 +45,9 @@
plot2_xts(R, FUN="CumReturns",
panels=c("addReturns(type='h')", "addDrawdowns()"))
+R <- edhec[,1:8]
layout(matrix(1:4, 2, 2))
-plot2_xts(R, multi.panel=1, FUN="CumReturns",
+plot2_xts(R, multi.panel=2, FUN="CumReturns",
panels=c("addReturns(type='h')", "addDrawdowns()"))
layout(matrix(1))
@@ -81,6 +84,7 @@
x$Env$call_list
x$Env$call_list[[1]]
+R <- edhec[,1:4]
plot2_xts(R, FUN="CumReturns")
plot2_xts(R, FUN="CumReturns", lty=1:4)
plot2_xts(R, FUN="CumReturns", lty=1:4, lwd=c(3, 1, 1, 1))
@@ -130,10 +134,10 @@
addLines2(tmp3, on=1, type="p", pch=2)
-# png("~/Documents/foo.png")
-# plot2_xts(R, FUN="CumReturns")
-# addDrawdowns()
-# dev.off()
+png("~/Documents/foo.png")
+plot2_xts(R, FUN="CumReturns")
+addDrawdowns()
+dev.off()
##### scratch area #####
# Should we have a theme object, as in quantmod, that sets all of the basic
More information about the Xts-commits
mailing list