graticule_labels: Create graticule labels.

View source: R/graticule.R

graticule_labelsR Documentation

Create graticule labels.

Description

Returns a set of points with labels, for plotting in conjuction with graticule.

Usage

graticule_labels(lons, lats, xline, yline, proj = NULL)

Arguments

lons

longitudes for meridional labels

lats

latitudes for parallel labels

xline

meridian/s for placement of parallel labels

yline

parallel/s for placement of meridian labels

proj

optional proj.4 string for output object

Details

SpatialPoints are returned in the projection of proj if given, or longlat / WGS84.

Value

SpatialPoints object with labels for downstream use

Examples

xx <- c(100, 120, 160, 180)
yy <- c(-80,-70,-60, -50,-45, -30)
prj <- "+proj=lcc +lon_0=150 +lat_0=-80 +lat_1=-85 +lat_2=-75 +ellps=WGS84"
plot(graticule(lons = xx, lats = yy,  proj = prj))
labs <- graticule_labels(lons = xx, lats = yy, xline = 100, yline = -80,  proj = prj)
op <- par(xpd = NA)
text(labs, lab = parse(text = labs$lab), pos = c(2, 1)[labs$islon + 1], adj = 1.2)
par(op)

graticule documentation built on Sept. 25, 2023, 5:06 p.m.