psbar {gmt}R Documentation

Add Bars to GMT Mercator Map

Description

Call GMT to add bars to the active map and save in postscript format. This function does the necessary calculations to render bars in standard height given a Mercator-projected map. It is not intended for other projections.

Usage

psbar(x, cmd="-JM -R -W1p -G180 -O -K", file=options("gmt.file"), ref=0,
      digits=options("digits"))

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.
ref reference latitude where Height=1 renders a bar 1 degree high.
digits precision used when rounding the geographic coordinates.

Details

The data are arranged in four columns: Lon, Lat, Width, and Height, in that order. See help(r2gmt) for valid data file format when argument x is a filename. See the GMT documentation for details on psxy and other GMT commands.

Value

Null, but the map is annotated and saved in postscript format.
As a side product, a temporary file ‘lastBAR.gmt’ is saved in the working directory.

Note

Assumes that GMT version 4 is installed, i.e. that psxy and other commands are in the path, and environment variable GMTHOME is defined.

The derivative of the Mercator projection is used to standardize the bar height:

f'(N) = 1 / (2 * tan(pi/4+N/2) * cos(pi/4+N/2)^2)

where N is latitude in radians and f(N) is the y-axis coordinate. The bar height at a given latitude is h*f'(ref)/f'(N), where h is the height passed by the user and ref is a reference latitude where h=1 renders a bar 1 degree high.

Author(s)

Arni Magnusson arnima@u.washington.edu.

See Also

barplot, postscript.

gmt-package gives an overview of the package.

Examples

## Not run: 
gmt(demo.par)
pscoast(demo.coast)
psxy(demo.xy)
pstext(demo.text)
psbar(demo.bar, ref=64)
psclose()
## End(Not run)

[Package gmt version 1.0-3 Index]