| scaleBathy | R Documentation |
Uses geographic information from object of class bathy to calculate and plot a scale in kilometer.
scaleBathy(mat, deg=1, x="bottomleft", y=NULL, inset=10, angle=90, ...)
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 |
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.
a scale added to the active graphical device
The calculation formula is from function map.scale of package maps. 6372.798 km is used as the Earth radius.
Eric Pante
plot.bathy
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.