Learn R Programming

oce (version 1.0-1)

mapContour: Add 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

vector of longitudes of points to be plotted, or an object of class topo (see topo-class), in which case longitude, latitude and z are inferred from that object.

latitude

vector of 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

vector of contour levels.

col

line color.

lty

line type.

lwd

line width.

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

A map must first have been created with mapPlot.

Other functions related to maps: lonlat2map, lonlat2utm, map2lonlat, mapArrows, mapAxis, mapDirectionField, mapGrid, mapImage, mapLines, mapLocator, mapLongitudeLatitudeXY, mapPlot, mapPoints, mapPolygon, mapScalebar, mapText, mapTissot, oceCRS, shiftLongitude, usrLonLat, utm2lonlat

Examples

Run this code
# NOT RUN {
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),
        projection="+proj=stere +lat_0=90")
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