Learn R Programming

raster (version 1.9-13)

scalebar: scalebar

Description

Add a scalebar to a plot

Usage

scalebar(d, xy = NULL, type = "line", divs = 2, below = "", lonlat = NULL, labels, adj=c(0.5, -0.5), lwd = 2, ...)

Arguments

d
distance covered by scalebar
xy
x and y coordinate to place the plot. Can be NULL. Use xy=click() to make this interactive
type
"line" or "bar"
divs
Number of divisions for a bar type. 2 or 4
below
Text to go below scalebar (e.g., "kilometers")
lonlat
If not NULL, this should be the average latitude of the plot. In that case d is interpreted to be in kilometers, but the scalebar is drawn in equivalent units in degrees
adj
adjustment for text placement
labels
Vector of three numbers to label the scale bar (beginning, midpoint, end)
lwd
line width for the "line" type scalebar
...
arguments to be passed to other methods

Value

  • None. Use for side effect of a scalebar added to a plot

See Also

plot

Examples

Run this code
r <- raster( system.file("external/test.grd", package="raster") )
plot(r)
scalebar(1000)
scalebar(1000, xy=c(178000, 333500), type='bar', divs=4)

Run the code above in your browser using DataLab