Learn R Programming

oce (version 0.9-18)

mapScalebar: Draw a scalebar on an existing map

Description

Draw a scalebar on an existing map

Usage

mapScalebar(x, y=NULL, length,
            lwd=1.5*par("lwd"), cex=par("cex"), col="black")

Arguments

x, y
position of the scalebar. Eventually this should be similar to the corresponding arguments in legend, but at the moment y must be NULL and x must be
length
length to indicate, in kilometres. If not provided, a reasonable choice is made, based on the underlying map.
lwd
scalebar line width
col
scalebar colour
cex
scalebar character size

Details

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.

See Also

See mapPlot for general information on plotting maps, including other functions.

Examples

Run this code
library(oce)
## Arctic Ocean
data(coastlineWorld)
latlim <- 90 + 25 * c(-1, 1)
lonlim <- c(-130, -50)
orientation <- c(90, -90, 0)
proj <- "stereographic"
fill <- "lightgray"
mapPlot(coastlineWorld, latitudelim=latlim, longitudelim=lonlim,
        proj=proj, orientation=orientation,
        axes=FALSE, fill=fill)
mapScalebar()

Run the code above in your browser using DataLab