sl.plot.lonlatgrid: Plot Longitude-Latitude Grid

sl.plot.lonlatgridR Documentation

Plot Longitude-Latitude Grid

Description

Plot a simple longitude-latitude grid over a spheRlab plot.

Usage

sl.plot.lonlatgrid(plot.init.res, lon.0 = 0, lat.0 = 0, lon.distance = NULL, lat.distance = NULL, lon.range = c(-180,180), lat.range = c(-90,90), autodensity.f = 1, pole.hole = FALSE, precision = 1, lty = 1, lwd = 0.25, col = "black", labels = FALSE, labels.lat.every = 3, labels.lat.first = ceiling(labels.lat.every/2), labels.lat.offsetlatlon = c(0,0), labels.lon.every = 3, labels.lon.first = ceiling(labels.lon.every/2), labels.lon.offsetlatlon = c(0,0), labels.col = "grey", labels.cex = 1)

Arguments

plot.init.res

a spheRlab plot specifics list as returned by sl.plot.init (or a variant thereof).

lon.0

a scalar specifying one of the longitudes (degrees east) to be drawn.

lat.0

a scalar specifying one of the latitudes (degrees north) to be drawn.

lon.distance

a scalar specifying the distance (degrees) between adjacent longitudes. Default is NULL, in which case a reasonable value is found automatically (can be further adjusted with the argument autodensity.f.)

lat.distance

a scalar specifying the distance (degrees) between adjacent longitudes. Default is NULL, in which case a reasonable value is found automatically (can be further adjusted with the argument autodensity.f.)

lon.range

a two-element numeric vector specifying the longitude range in which grid lines are to be drawn. Default is c(-180,180).

lat.range

a two-element numeric vector specifying the latitude range in which grid lines are to be drawn. Default is c(-90,90).

autodensity.f

a scalar that can be used to adjust the density of automatically derived values for lat.distance and/or lon.distance (used only if the latter are NULL). Default is autodensity.f=1.

pole.hole

a logical value indicating whether or not to let longitudinal lines end at the last latitude(s) before the pole(s).

precision

a scalar specifying the precision (degrees) at which longitudes and latitudes are broken into line segments (which are drawn as straight lines).

lty

a line type.

lwd

a scalar specifying the line width.

col

a line colour.

labels

a logical value indicating whether or not to add longitude and latitude labels. Note that the placement of labels is determined automatically based on the lon-lat-grid, with some arguments to control the behaviour. Latitude labels are placed between lines of longitudes and vice versa. For more flexibility, use sl.plot.lonlatlabels directly.

labels.lat.every

an integer specifying the density in latitudinal direction at which labels are plotted. Affects latitude and longitude labels coherently.

labels.lat.first

an integer specifying the first latitude to receive a latitude label. Affects latitude and longitude labels coherently such that longitude labels are placed between latitude labels.

labels.lat.offsetlatlon

a 2-element numeric vector specifying the degrees latitude and longitude by which latitude labels are to be shifted.

labels.lon.every

an integer specifying the density in longitudinal direction at which labels are plotted. Affects latitude and longitude labels coherently.

labels.lon.first

an integer specifying the first longitude to receive a longitude label. Affects longitude and latitude labels coherently such that latitude labels are placed between longitude labels.

labels.lon.offsetlatlon

a 2-element numeric vector specifying the degrees latitude and longitude by which longitude labels are to be shifted.

labels.col

the color to be used for the labels.

labels.cex

numeric character expansion factor for the labels; multiplied by par("cex") yields the final character size. NULL and NA are equivalent to 1.0.

Note

Some standard lon-lat grids can also be plotted using sl.plot.naturalearth.

If you set labels=TRUE, note that the placement of labels is determined automatically based on the lon-lat-grid, with few arguments to control the behaviour. For more flexibility, use sl.plot.lonlatlabels directly.

If grid lines are very dense, this function can be quite slow even if only a small map section is actually plotted. In such cases, the arguments lon.range and lat.range can be used to considerably speed up the process.

Author(s)

Helge Goessling

See Also

sl.plot.naturalearth, sl.plot.lonlatlabels

Examples

## Not run: 
pir = sl.plot.init()
sl.plot.naturalearth(pir, resolution="coarse")
sl.plot.lonlatgrid(pir, labels=TRUE, labels.lat.first=3, labels.lon.first=1, labels.cex=0.7, labels.col="red")
sl.plot.end(pir)
### Should result in a pdf file named 'sl.plot.pdf' in your home directory.

## End(Not run)

helgegoessling/spheRlab documentation built on April 8, 2024, 8:34 a.m.