Learn R Programming

oce (version 0.8-10)

oceContour: Contour with ability to flip x and y

Description

This provides something analagous to contour, but with the ability to flip x and y.

Usage

oceContour(x, y, z, revx=FALSE, revy=FALSE, ...)

Arguments

x
values for x grid.
y
values for y grid.
z
matrix for values to be contoured. The first dimension of z must equal the number of items in x, etc.
revx
set to TRUE to reverse the order in which the labels on the x axis are drawn
revy
set to TRUE to reverse the order in which the labels on the y axis are drawn
...
optional arguments passed to plotting functions.

Details

It is common in oceanography to plot depth below the surface on the y axis, but also to need to put surface data at the top of the graph, and setting revy=TRUE accomplishes this.

Examples

Run this code
library(oce)
data(adp)
U <- adp[["v"]][,,1]
t <- adp[["time"]]
distance <- adp[["distance"]]
z <- distance - max(distance) 
depth <- abs(z)
par(mfrow=c(3,1), mar=c(3, 3, 1, 1), mgp=c(2, 0.7, 0))
contour(t,distance,U,levels=0, ylab="Distance")
oceContour(t,z,U,levels=0, ylab="z")
oceContour(t,depth,U,levels=0,revy=TRUE, ylab="depth")

Run the code above in your browser using DataLab