mapScalebar | R Documentation |
Draw a scalebar on a map created by mapPlot()
or plot,coastline-method()
.
For plots made otherwise, see ‘Details’.
mapScalebar(
x,
y = NULL,
length,
lwd = 1.5 * par("lwd"),
cex = par("cex"),
col = "black",
debug = getOption("oceDebug")
)
x , y |
position of the scalebar. Eventually these two items may be
handled similarly 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. |
debug |
an integer specifying whether debugging information is
to be printed during the processing. This is a general parameter that
is used by many |
It is also possible to use this with any plot, but the results will
only make sense if the aspect ratio is set properly so that an item that is
circular in nature is (very closely) circular on the plot. This aspect ratio
condition is met by both mapPlot()
and plot,coastline-method()
.
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.
Dan Kelley
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.