Learn R Programming

gmt (version 1.2-0)

psxy: Add Lines/Symbols to GMT Map

Description

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

Usage

psxy(x, cmd="-J -R -Scp -W2p -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 psxy.
file
filename where the map is saved.

Value

Null, but the map is annotated and saved in postscript format.The temporary GMT input file ‘xy.gmt’ is saved in directory dirname(tempdir()), for the user to view or edit. It is later removed by psclose().

Details

The data are arranged in two (Lon, Lat) or more columns, depending on the -S argument.

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 psxy and other GMT commands.

See Also

Similar to points, lines, 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

Run this code
## Not run: 
# # Draw map and save as "map.eps" in current working directory
# gmt(demo.par)
# pscoast(demo.coast)
# psxy(demo.xy)
# pstext(demo.text)
# psbar(demo.bar, ref=66)
# psclose()
# # See directory gmt/example for details
# 
# # Simple map and circles
# gmt("PAPER_MEDIA a4+")
# pscoast("-JM12c -R158/192/-42/-8 -Di -Gdarkgreen -B10f5 -A2000 -K", "quake.eps")
# psxy(data.frame(lon=quakes$lon, lat=quakes$lat, mag=10^quakes$mag/1e6),
#      "-J -R -Scp -W0.5p,red -O", "quake.eps")
# ## End(Not run)

Run the code above in your browser using DataLab