scaleBathy {marmap} | R Documentation |
Adds a scale to a map
Description
Uses geographic information from object of class bathy
to calculate and plot a scale in kilometer.
Usage
scaleBathy(mat, deg=1, x="bottomleft", y=NULL, inset=10, angle=90, ...)
Arguments
mat |
bathymetric data matrix of class |
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 |
angle |
angle from the shaft of the arrow to the edge of the arrow head |
... |
further arguments to be passed to |
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.
Value
a scale added to the active graphical device
Note
The calculation formula is from function map.scale
of package maps
. 6372.798 km is used as the Earth radius.
Author(s)
Eric Pante
See Also
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)