Learn R Programming

oce (version 0.9-18)

oce.grid: Add a grid to an existing plot, with special abilities for those created by oce

Description

Add a grid to an existing plot, with special abilities for those created by oce

Usage

oce.grid(xat, yat, col = "lightgray", lty = "dotted", lwd = par("lwd"))

Arguments

xat
either a list of x values at which to draw the grid, or the return value from an oce plotting function
yat
a list of y values at which to plot the grid (ignored if gx was a return value from an oce plotting function)
col
colour of grid lines (see par)
lty
type for grid lines (see par)
lwd
width for grid lines (see par)

Value

  • nothing

Details

For plots not created by oce functions, or for missing xat and yat, this is the same as a call to grid with missing nx and ny. However, if xat is the return value from certain oce functions, a more sophisticated grid is constructed. The problem with grid is that it cannot handle axes with non-uniform grids, e.g. those with time axes that span months of differing lengths.

As of early February 2015, oce.grid handles xat produced as the return value from the following functions: imagep and oce.plot.ts, plot.adp, plot.echosounder, and plotTS. It makes no sense to try to use oce.grid for multiplanel oce plots, e.g. the default plot from plot.adp.

Examples

Run this code
library(oce)
i <- imagep(volcano)
oce.grid(i, lwd=2)

data(sealevel)
i <- oce.plot.ts(sealevel[["time"]], sealevel[["elevation"]])
oce.grid(i, col='red')

data(ctd)
i <- plotTS(ctd)
oce.grid(i, col='red')

data(adp)
i <- plot(adp, which=1)
oce.grid(i, col='gray', lty=1)

data(echosounder)
i <- plot(echosounder)
oce.grid(i, col='pink', lty=1)

Run the code above in your browser using DataLab