Learn R Programming

oce (version 0.1-80)

oce.plot.ts: Plot a time-series, obeying the timezone

Description

Plot a time-series, obeying the timezone and possibly drawing the range in the top-left margin

Usage

oce.plot.ts(x, y, draw.time.range=TRUE, xaxs="i", grid=TRUE, adorn=NULL, fill=FALSE, ...)

Arguments

x
the times of observations.
y
the observations.
draw.time.range
a boolean, set to TRUE to indicate the range of times in the top-left margin.
xaxs
character indicating whether image should extend to edge of x axis (with value "i") or not; see par("xaxs").
grid
boolean, set to TRUE to get a grid on the plot. (Note that grid does work correctly because it does not account properly for tic locations on the time axis.
adorn
optional expression to be performed immediately after drawing the panel. (See plot.adp for an example.)
fill
boolean, set TRUE to fill the curve to zero (which it does incorrectly if there are missing values in y).
...
graphical parameters passed down to plot.

Details

Depending on the version of R, the standard plot and plot.ts routines will not obey the time zone of the data. This routine gets around that problem. It can also plot the time range in the top-left margin, if desired; this string includes the timezone, to remove any possible confusion.

For flexibility, this does not set to line-type plots; use type='l' to get these.

References

Color Brewer. http://www.personal.psu.edu/cab38/ColorBrewer/ColorBrewer.html

Light, A., and P. J. Bartlein, 2004. The End of the Rainbow? Color Schemes for Improved Data Graphics. Eos Trans. AGU, 85(40), doi:10.1029/2004EO400002.

Martin Jakobsson, Ron Macnab, and Members of the Editorial Board, IBCAO. Selective comparisons of GEBCO (1979) and IBCAO (2000) maps. http://www.ngdc.noaa.gov/mgg/bathymetry/arctic/ibcao_gebco_comp.html

Stephenson, David B., 2005. Comment on ``Color schemes for improved data graphics,'' by A. Light and P. J. Bartlein. Eos Trans. AGU, 86(20).

Examples

Run this code
library(oce)
t.start <- as.POSIXct("2008-01-01", tz="UTC")
t <- seq(t.start, length.out=48, by="30 min")
y <- sin(as.numeric(t - t.start) * 2 * pi / (12 * 3600))
oce.plot.ts(t, y, type='l', xaxs='i')

Run the code above in your browser using DataLab