diff --git a/NAMESPACE b/NAMESPACE index cb74f1df..53cc359f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -122,9 +122,11 @@ export(axTicksByTime) export(plot.xts) export(addLegend) export(addEventLines) -export(addPoints) +# export(addPoints) export(addSeries) S3method(plot,xts) +S3method(lines,xts) +S3method(points,xts) S3method(print, replot_xts) S3method(plot, replot_xts) diff --git a/R/plot.R b/R/plot.R index 6f6d21b0..d0a30df2 100644 --- a/R/plot.R +++ b/R/plot.R @@ -865,6 +865,15 @@ addSeries <- function(x, main="", on=NA, type="l", col=NULL, lty=1, lwd=1, pch=0 plot_object } +lines.xts <- function(x, ..., main="", on=NA, col=NULL, lty=1, lwd=1, pch=0){ + addSeries(x, ...=..., main=main, on=on, type="l", col=col, lty=lty, lwd=lwd, pch=pch) +} + + +# addPoints <- function(x, main="", on=NA, col=NULL, pch=0, ...){ +# addSeries(x, main=main, on=on, type="p", col=col, pch=pch, ...) +# } + #' Add time series of points to an existing xts plot #' #' @param x an xts object to plot. @@ -874,8 +883,8 @@ addSeries <- function(x, main="", on=NA, type="l", col=NULL, lty=1, lwd=1, pch=0 #' @param pch the type of plot to be drawn, same as in \code{\link{plot}}. #' @param \dots any other passthrough parameters. Not currently used. #' @author Ross Bennett -addPoints <- function(x, main="", on=NA, col=NULL, pch=0, ...){ - addSeries(x, main=main, on=on, type="p", col=col, pch=pch, ...) +points.xts <- function(x, ..., main="", on=NA, col=NULL, pch=0){ + addSeries(x, ...=..., main=main, on=on, type="p", col=col, pch=pch) } #' Add vertical lines to an existing xts plot diff --git a/man/lines.xts.Rd b/man/lines.xts.Rd new file mode 100644 index 00000000..04fe75b3 --- /dev/null +++ b/man/lines.xts.Rd @@ -0,0 +1,30 @@ +\name{lines.xts} +\alias{lines.xts} +\title{Add time series lines to an existing xts plot} +\usage{ +\method{lines}{xts}(x, ..., main = "", on = NA, col = NULL, lty = 1, + lwd = 1, pch = 0) +} +\arguments{ +\item{x}{an xts object to plot.} + +\item{\dots}{any other passthrough parameters. Not currently used.} + +\item{main}{main title for a new panel if drawn.} + +\item{on}{panel number to draw on. A new panel will be drawn if \code{on=NA}.} + +\item{col}{color palette to use, set by default to rational choices.} + +\item{lty}{set the line type, same as in \code{\link{plot}}.} + +\item{lwd}{set the line width, same as in \code{\link{plot}}.} + +\item{pch}{the type of plot to be drawn, same as in \code{\link{plot}}.} +} +\description{ +Add time series lines to an existing xts plot +} +\author{ +Ross Bennett +} \ No newline at end of file diff --git a/man/addPoints.Rd b/man/points.xts.Rd similarity index 78% rename from man/addPoints.Rd rename to man/points.xts.Rd index e1d9fc03..76f14eb2 100644 --- a/man/addPoints.Rd +++ b/man/points.xts.Rd @@ -1,13 +1,14 @@ -% Generated by roxygen2 (4.0.1): do not edit by hand -\name{addPoints} -\alias{addPoints} +\name{points.xts} +\alias{points.xts} \title{Add time series of points to an existing xts plot} \usage{ -addPoints(x, main = "", on = NA, col = NULL, pch = 0, ...) +\method{points}{xts}(x, ..., main = "", on = NA, col = NULL, pch = 0) } \arguments{ \item{x}{an xts object to plot.} +\item{\dots}{any other passthrough parameters. Not currently used.} + \item{main}{main title for a new panel if drawn.} \item{on}{panel number to draw on. A new panel will be drawn if \code{on=NA}.} @@ -15,8 +16,6 @@ addPoints(x, main = "", on = NA, col = NULL, pch = 0, ...) \item{col}{color palette to use, set by default to rational choices.} \item{pch}{the type of plot to be drawn, same as in \code{\link{plot}}.} - -\item{\dots}{any other passthrough parameters. Not currently used.} } \description{ Add time series of points to an existing xts plot