Learn R Programming

oce (version 0.9-5)

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
latitude
latitudes of points to be plotted
z
matrix to be contoured
nlevels
number of contour levels
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)
longitude <- coastlineWorld[['longitude']]
latitude <- coastlineWorld[['latitude']]
## Canada and Arctic Ocean, with 500m isobath in blue
mapPlot(longitude, latitude, type='l',
        latitudelim=c(50,120), longitudelim=c(-80,10),
        grid=10,
        projection="orthographic", orientation=c(45,-100,0))
data(topoWorld)
lon <- topoWorld[['longitude']]
lat <- topoWorld[['latitude']]
z <- topoWorld[['z']] 
mapContour(lon, lat, z, levels=-1000, lty='dotted')

Run the code above in your browser using DataLab