mat: bathymetric data matrix of class bathy, imported using read.bathy
deg: the number of degrees of longitudes to convert into kilometers (default is 1)
x, y: the coordinates used to plot the scale on the map (see Details)
inset: when x is a keyword (e.g. "bottomleft"), inset is a percentage of the plotting space controlling the relative position of the plotted scale (see Examples)
angle: angle from the shaft of the arrow to the edge of the arrow head
...: further arguments to be passed to text
Details
scaleBathy is a simple utility to add a scale to the lower left corner of a bathy plot. The distance in kilometers between two points separated by 1 degree longitude is calculated based on the minimum latitude of the bathy object used to plot the map. Option deg allows the user to plot the distance separating more than one degree (default is one).
The plotting coordinates x and y either correspond to two points on the map (i.e. longitude and latitude of the point where the scale should be plotted), or correspond to a keyword (set with x, y being set to NULL) from the list "bottomright", "bottomleft", "topright", "topleft". When a keyword is used, the option inset controls how far the scale will be from the edges of the plot.
Returns
a scale added to the active graphical device
Author(s)
Eric Pante
Note
The calculation formula is from function map.scale of package maps. 6372.798 km is used as the Earth radius.
See Also
plot.bathy
Examples
# load NW Atlantic data and convert to class bathy data(nw.atlantic) atl <- as.bathy(nw.atlantic)# a simple example plot(atl, deep=-8000, shallow=-1000, step=1000, lwd=0.5, col="grey") scaleBathy(atl, deg=4)# using keywords to place the scale with inset=10% par(mfrow=c(2,2)) plot(atl, deep=-8000, shallow=-1000, step=1000, lwd=0.5, col="grey") scaleBathy(atl, deg=4, x="bottomleft", y=NULL) plot(atl, deep=-8000, shallow=-1000, step=1000, lwd=0.5, col="grey") scaleBathy(atl, deg=4, x="bottomright", y=NULL)# using keywords to place the scale with inset=20% plot(atl, deep=-8000, shallow=-1000, step=1000, lwd=0.5, col="grey") scaleBathy(atl, deg=4, x="topleft", y=NULL, inset=20) plot(atl, deep=-8000, shallow=-1000, step=1000, lwd=0.5, col="grey") scaleBathy(atl, deg=4, x="topright", y=NULL, inset=20)