mapScalebar | R Documentation |
Draw a scalebar on a map created by mapPlot()
or otherwise.
mapScalebar(
x,
y = NULL,
length,
lwd = 1.5 * par("lwd"),
cex = par("cex"),
col = "black"
)
x , y |
position of the scalebar. Eventually this may be similar to
the corresponding arguments in |
length |
the distance to indicate, in kilometres. If not provided, a reasonable choice is made, based on the existing plot. |
lwd |
line width of the scalebar. |
cex |
character expansion factor for the scalebar text. |
col |
color of the scalebar. |
The scale is appropriate to the centre of the plot, and will become increasingly inaccurate away from that spot, with the error depending on the projection and the fraction of the earth that is shown.
Until December 2020, it was required that the map had been drawn by mapPlot()
,
but now it can be any diagram showing longitude and latitude in degrees.
Dan Kelley
A map must first have been created with mapPlot()
.
Other functions related to maps:
formatPosition()
,
lonlat2map()
,
lonlat2utm()
,
map2lonlat()
,
mapArrows()
,
mapAxis()
,
mapContour()
,
mapCoordinateSystem()
,
mapDirectionField()
,
mapGrid()
,
mapImage()
,
mapLines()
,
mapLocator()
,
mapLongitudeLatitudeXY()
,
mapPlot()
,
mapPoints()
,
mapPolygon()
,
mapText()
,
mapTissot()
,
oceCRS()
,
oceProject()
,
shiftLongitude()
,
usrLonLat()
,
utm2lonlat()
library(oce)
data(coastlineWorld)
# Arctic Ocean
par(mar = c(2.5, 2.5, 1, 1))
mapPlot(coastlineWorld,
latitudelim = c(60, 120), longitudelim = c(-130, -50),
col = "lightgray", projection = "+proj=stere +lat_0=90"
)
mapScalebar()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.