ptext: Projected text function

Description Usage Arguments Details See Also Examples

View source: R/ptext.R

Description

ptext draws the character strings given in labels at the provided coordinates, possibly after projection.

Usage

1
ptext(x, y = NULL, labels, proj, ...)

Arguments

x

numeric vectors of coordinates where the text labels should be written. If the length of x and y differs, the shorter one is recycled.

y

numeric vectors of coordinates where the text labels should be written. If the length of x and y differs, the shorter one is recycled.

labels

a character vector or expression specifying the text to be written. An attempt is made to coerce other language objects (names and calls) to expressions, and vectors and other classed objects to character vectors by as.character. If labels is longer than x and y, the coordinates are recycled to the length of labels.

proj

A character string indicating what projection should be used for the included x and y coordinates. The default is "none". The other valid choices correspond to the "projection" argument in the mapproject function, which is used for the projection.

...

further graphical parameters (from par), such as srt, family and xpd.

Details

The mapproject function is used for projection.

A non-character labels argument is automatically converted to a character vector using link[base]{as.character}.

See Also

text, mapproject, pimage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(narccap)
# plot image using bonne projection (w/o grid lines)
pimage(lon, lat, tasmax[,,1], proj = "bonne",
       parameters = 40, paxes.args = list(grid = FALSE))
# get national boundaries
data(worldMapEnv, package = "maps")
worldpoly <- maps::map("world", plot = FALSE)
plines(worldpoly, proj = "bonne")
# add U.S. city names to existing plot
data(us.cities, package = "maps")
citysmall <- head(us.cities)
ptext(x = citysmall$lon, y = citysmall$lat, 
      labels = citysmall$name, proj = "bonne")

jpfrench81/autoimage documentation built on March 17, 2021, 12:09 a.m.