Plot contours on an existing map.

mapContour(
longitude,
latitude,
z,
nlevels = 10,
levels = pretty(range(z, na.rm = TRUE), nlevels),
labcex = 0.6,
drawlabels = TRUE,
underlay = "erase",
col = par("fg"),
lty = par("lty"),
lwd = par("lwd"),
debug = getOption("oceDebug")
)

## Arguments

longitude numeric vector of longitudes of points to be plotted, or an object of class topo (see topo), in which case longitude, latitude and z are inferred from that object. numeric vector of latitudes of points to be plotted. matrix to be contoured. The number of rows and columns in z must equal the lengths of longitude and latitude, respectively. number of contour levels, if and only if levels is not supplied. vector of contour levels. cex value used for contour labelling. As with contour(), this is an absolute size, not a multiple of par("cex"). logical value or vector indicating whether to draw contour labels. If the length of drawlabels is less than the number of levels specified, then rep() is used to increase the length, providing a value for each contour line. For those levels that are thus indicated, labels are added, at a spot where the contour line is closest to horizontal on the page. First, though, the region underneath the label is filled with the colour given by par("bg"). See “Limitations” for notes on the status of contour labelling, and its limitations. character value relating to handling labels. If this equals "erase" (which is the default), then the contour line is drawn first, then the area under the label is erased (filled with white 'ink'), and then the label is drawn. This can be useful in drawing coarsely-spaced labelled contours on top of finely-spaced unlabelled contours. On the othr hand, if underlay equals "interrupt", then the contour line is interrupted in the region of the label, which is closer to the scheme used by the base contour() function. colour of the contour line, as for par("col"), except here col gets lengthened by calling rep(), so that individual contours can be coloured distinctly. type of the contour line, as for par("lty"), except for lengthening, as described for col. width of the contour line, as for par("lwd"), except for lengthening, as described for col and lty. an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of debug first, so that a user can often obtain deeper debugging by specifying higher debug values.

## Details

Adds contour lines to an existing map, using mapLines().

The ability to label the contours was added in February, 2019, and how this works may change through the summer months of that year. Note that label placement in mapContour is handled differently than in contour().

A map must first have been created with mapPlot().

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

## Examples

# \donttest{
library(oce)
data(coastlineWorld)
if (requireNamespace("ocedata", quietly=TRUE)) {
data(levitus, package="ocedata")
par(mar=rep(1, 4))
mapPlot(coastlineWorld, projection="+proj=robin", col="lightgray")
mapContour(levitus[['longitude']], levitus[['latitude']], levitus[['SST']])
}# }