pstext: Add Text/Symbols to GMT Map

View source: R/pstext.R

pstextR Documentation

Add Text/Symbols to GMT Map

Description

Call GMT to add text/symbols to a map and save in postscript format.

Usage

pstext(x, cmd="-J -R -O -K", file=getOption("gmt.file"))

Arguments

x

data frame, matrix, or filename containing the data to be plotted.

cmd

string of arguments passed to GMT shell command pstext.

file

filename where the map is saved.

Details

The cmd argument can be used to specify the data columns:

Format (cmd) Data columns Notes
⁠-J -R -O -K⁠ ⁠Lon Lat Text⁠ (default)
⁠-J -R -F+f+a+j -O -K⁠ ⁠Lon Lat Font Angle Justify Text⁠ (see example)

If x is a filename, the data should be tabular with or without a header, separated by commas or whitespace. The first line is interpreted as header if the first non-whitespace character is not minus, point, or number.

See the GMT documentation for details on pstext and other GMT commands.

Value

NULL, but the map is annotated and saved in postscript format.

The temporary GMT input file ‘text.gmt’ is saved in directory dirname(tempdir()), for the user to view or edit. It is later removed by psclose().

See Also

Similar to text and postscript in native R graphics.

gmt, pscoast, psxy, pstext, psbar, and psclose work together to draw maps.

gmt-package gives an overview of the package.

Examples

## Not run: 
# Draw map and save as "map.ps" in current working directory
gmt(demo.par)
pscoast(demo.coast)
psxy(demo.xy)
pstext(demo.text, "-J -R -F+f+a+j -O -K")
psbar(demo.bar, ref=66)
psclose()
# See directory gmt/example for details

## End(Not run)

arnima-github/gmt documentation built on April 21, 2023, 7:12 p.m.