Last chance! 50% off unlimited learning
Sale ends in
Draw a scalebar on an existing map.
mapScalebar(
x,
y = NULL,
length,
lwd = 1.5 * par("lwd"),
cex = par("cex"),
col = "black"
)
position of the scalebar. Eventually this may be similar to
the corresponding arguments in legend()
, but at the moment
y
must be NULL
and x
must be "topleft"
.
the distance to indicate, in kilometres. If not provided, a reasonable choice is made, based on the underlying map.
line width of the scalebar.
character expansion factor for the scalebar text.
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.
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()
,
shiftLongitude()
,
usrLonLat()
,
utm2lonlat()
# NOT RUN {
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()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab