Plot longitude and latitude grid on an existing map.
This is an advanced function, requiring
coordination with mapPlot()
and (possibly) also with mapAxis()
,
and so it is best avoided by novices, who may be satisfied
with the defaults used by mapPlot()
.
mapGrid(
dlongitude = 15,
dlatitude = 15,
longitude,
latitude,
col = "darkgray",
lty = "solid",
lwd = 0.5 * par("lwd"),
polarCircle = 0,
longitudelim,
latitudelim,
debug = getOption("oceDebug")
)
A data.frame, returned silently, containing
"side"
, "value"
, "type"
, and "at"
.
A default call to mapPlot()
ensures agreement of grid and axes by using
this return value in a call to mapAxis()
.
increment in longitude, ignored if longitude
is supplied, but otherwise determines the longitude sequence.
increment in latitude, ignored if latitude
is supplied, but otherwise determines the latitude sequence.
numeric vector of longitudes, or NULL
to prevent drawing
longitude lines.
numeric vector of latitudes, or NULL
to prevent drawing
latitude lines.
color of lines
line type
line width
a number indicating the number of degrees of latitude extending from the poles, within which zones are not drawn.
optional argument specifying suggested longitude limits
for the grid. If this is not supplied, grid lines are drawn for the
whole globe, which can yield excessively slow drawing speeds for
small-region plots. This, and latitudelim
, are both set by
mapPlot()
if the arguments of the same name are passed to
that function.
similar to longitudelim
.
a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, 2 to go two function levels deep, or 3 to go all the way to the core functions. Any value above 3 will be truncated to 3.
Dan Kelley
This is somewhat analogous to grid()
, except that the
first two arguments of the latter supply the number of lines in the grid,
whereas the present function has increments for the first two arguments.
A map must first have been created with mapPlot()
.
Other functions related to maps:
formatPosition()
,
lonlat2map()
,
lonlat2utm()
,
map2lonlat()
,
mapArrows()
,
mapAxis()
,
mapContour()
,
mapCoordinateSystem()
,
mapDirectionField()
,
mapImage()
,
mapLines()
,
mapLocator()
,
mapLongitudeLatitudeXY()
,
mapPlot()
,
mapPoints()
,
mapPolygon()
,
mapScalebar()
,
mapText()
,
mapTissot()
,
oceCRS()
,
shiftLongitude()
,
usrLonLat()
,
utm2lonlat()
# \donttest{
if (utils::packageVersion("sf") != "0.9.8") {
# sf version 0.9-8 has a problem with this projection
library(oce)
data(coastlineWorld)
par(mar=c(2, 2, 1, 1))
# In mapPlot() call, note axes and grid args, to
# prevent over-plotting of defaults.
mapPlot(coastlineWorld, type="l", projection="+proj=ortho",
axes=FALSE, grid=FALSE)
mapGrid(15, 15)
}
# }
Run the code above in your browser using DataLab