Learn R Programming

oce (version 0.9-20)

mapPolygon: Add a Polygon to a Map

Description

Plot a polygon on an existing map.

Usage

mapPolygon(longitude, latitude, density = NULL, angle = 45, border = NULL, col = NA, lty = par("lty"), ..., fillOddEven = FALSE)

Arguments

longitude
longitudes of points to be plotted, or an object from which longitude and latitude can be inferred (e.g. a coastline file, or the return value from mapLocator), in which case the following two arguments are ignored.
latitude
latitudes of points to be plotted.
density
as for polygon.
angle
as for polygon.
border
as for polygon.
col
as for polygon.
lty
as for polygon.
...
as for polygon.
fillOddEven
as for polygon.

Details

Adds a polygon to an existing map, by analogy to polygon. Used by mapImage.

See Also

A map must first have been created with mapPlot.

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

Examples

Run this code
## Not run: 
# library(oce)
# data(coastlineWorld)
# mapPlot(coastlineWorld, type='l',
#         longitudelim=c(-70,-50), latitudelim=c(40,50),
#         proj="polyconic", orientation=c(90, -90,0), grid=TRUE)
# data(topoWorld)
# tlon <- topoWorld[['longitude']][550:650]
# tlat <- topoWorld[['latitude']][240:300]
# z <- topoWorld[['z']][550:650, 240:300]
# mapImage(tlon, tlat, z)
# mapLines(coastlineWorld[['longitude']], coastlineWorld[['latitude']])
# ## End(Not run)

Run the code above in your browser using DataLab