Learn R Programming

oce (version 0.9-18)

mapContour: Plot contours on a existing map

Description

Plot contours on an existing map

Usage

mapContour(longitude=seq(0, 1, length.out=nrow(z)),
latitude=seq(0, 1, length.out=ncol(z)),
z,
nlevels=10, levels=pretty(range(z, na.rm=TRUE), nlevels), 
col=par("fg"), lty=par("lty"), lwd=par("lwd"))

Arguments

longitude
longitudes of points to be plotted, or an object of class topo (see topo-class), in which case longitude, latitude and z are inferred f
latitude
latitudes of points to be plotted
z
matrix to be contoured
nlevels
number of contour levels, if and only if levels is not supplied
levels
list of contour levels
col
colour of lines
lty
type of lines
lwd
width of lines

Bugs

As with mapLines, long lines should be subdivided into multiple segments so that e.g. great circle lines will be curved.

Details

Adds contour lines to an existing map, using mapLines. The arguments are based on those to contour and contourLines.

See Also

See mapPlot for general information on plotting maps, including other functions.

Examples

Run this code
library(oce)
data(coastlineWorld)
par(mar=rep(1, 4))
## Arctic 100m, 2km, 3km isobaths, showing shelves and ridges.
mapPlot(coastlineWorld,
        latitudelim=c(60,120), longitudelim=c(-130,-50), 
        proj="stereographic", orientation=c(90, -90, 0), 
axes=FALSE, fill='lightgray')
data(topoWorld)
lon <- topoWorld[['longitude']]
lat <- topoWorld[['latitude']]
z <- topoWorld[['z']] 
mapContour(lon, lat, z, levels=c(-100, -2000, -3000),col=1:3,lwd=2)

Run the code above in your browser using DataLab