ptext {autoimage}R Documentation

Projected text function

Description

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

Usage

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

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")

[Package autoimage version 2.2.3 Index]