baytrends (version 1.1.0)

timePlot: Time-series Plots

Description

Creates a plot of time-series data.

Usage

timePlot(x, y, Plot = list(), yaxis.log = FALSE, yaxis.rev = FALSE,
  yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE),
  ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = "",
  caption = "", margin = c(NA, NA, NA, NA), ...)

# S4 method for Date,numeric timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)

# S4 method for POSIXt,numeric timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)

# S4 method for numeric,numeric timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)

# S4 method for integer,numeric timePlot(x, y, Plot = list(name = "", what = "points", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE) + c(-1, 1), ylabels = 7, xlabels = "Auto", xtitle = "", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), xlabels.rotate = FALSE, ...)

# S4 method for difftime,numeric timePlot(x, y, Plot = list(name = "", what = "lines", type = "solid", width = "standard", symbol = "circle", filled = TRUE, size = 0.09, color = "black"), yaxis.log = FALSE, yaxis.rev = FALSE, yaxis.range = c(NA, NA), xaxis.range = range(x, na.rm = TRUE), ylabels = 7, xlabels = "Auto", xtitle = "Auto", ytitle = deparse(substitute(y)), caption = "", margin = c(NA, NA, NA, NA), ...)

Arguments

x

the time/date data.

y

the y-axis data.

Plot

parameters defining the characteristics of the plot. See setPlot for a description of the parameters.

yaxis.log

logical, if TRUE, then log-transform the y axis.

yaxis.rev

logical, if TRUE, then reverse the y axis.

yaxis.range

set the range of the y-axis. See Details.

xaxis.range

set the range of the x-axis. Set at January 1 through December 31 for seasonPlot.

ylabels

set up y-axis labels. See linearPretty for details.

xlabels

set up x-axis labels. See Details for details for valid values.

xtitle

the x-axis title (also called x-axis caption). Generally should be blank as titles are typically set up by the axis labeling routines.

ytitle

the y-axis title (also called y-axis caption).

caption

the figure caption.

margin

set the plot area margins, in units of lines of text. Generally all NA or the output from setGraph if appropriate.

...

arguments for specific methods.

xlabels.rotate

logical, if TRUE, then rotate the x-axis labels so that they are perpendicular to the x-axis.

Value

Information about the graph.

Methods

signature(x = "Date", y = "numeric")

Create a time-series plot for Date and numeric data.

signature(x ="POSIXt", y = "numeric")

Create a time-series plot for POSIXt and #' numeric data.

signature(x = "numeric", y = "numeric")

Create a time-series plot for dates in decimal format and numeric data.

signature(x = "integer", y = "numeric")

Create a time-series plot for annual summaries of numeric data.

signature(x = "difftime", y = "numeric")

Create a time-series plot for difftime and numeric data.

Details

For the timePlot methods where the time/date data are of class "Date," "POSIXt," or "numeric," the values for xlabels must be one of "hours," "days," "months," "years," "water years," or "Auto," which will select an appropriate axis labeling scheme based on the time span of the data. May also be a list of valid arguments to datePretty for finer control.

For the timePlot method where the time/date data are of class "integer," the value for xlabels must be one of "Auto," a number indicating the approximate number of labels, or a list of valid arguments to linearPretty for finer control.

For the timePlot method where the time/date data are of class "difftime," the value for xlabels must be one of "Auto" or a number indicating the approximate number of labels.

For linear axes, the range can be set to virtually any pair of values. For log axes, the choice of range is more resticted---for less than one log-cycle, powers of whole numbers can be used; from 1 to about 3 log cycles, the choces should be powers of 3 or 10; and for more than 3 log cycles, the range sould be expressed only in powers of 10.

Added from smwrGraphs.

Examples

Run this code
# NOT RUN {
# the months function is in lubridate
X <- as.Date("2001-01-15") + months(0:11)
set.seed(1)
Y <- runif(12)
setGD()
timePlot(X, Y)
# For more details of timePlot see
vignette(topic="DateAxisFormats", package="smwrGraphs")
vignette(topic="LineScatter", package="smwrGraphs")
demo(topic="AnnualFlowBarChart", package="smwrGraphs")
demo(topic="DurationHydrograph", package="smwrGraphs")
demo(topic="HydroPrecip", package="smwrGraphs")
demo(topic="RightAxisExample", package="smwrGraphs")
# }

Run the code above in your browser using DataLab