Learn R Programming

SDMTools (version 1.1-221)

Scalebar: Scalebar for Projected Maps

Description

Scalebar adds a distance scalebar onto a projected map. It is not appropriate for geographic projections.

Usage

Scalebar(x, y, distance, unit = "km", scale = 1, t.cex = 0.8)

Arguments

x
the x-axis position for the lower left corner of the bar
y
the x-axis position for the lower left corner of the bar
distance
the distance for which the scale bar should represent
unit
the units to report as the scaling
scale
the scaling factor to rescale the distance to a different unit. e.g., if your map is in m and want the scalebar to be in km, use a scale of 0.01
t.cex
the scaling of the font size to be used for the scalebar

Value

nothing is returned, simply a scalebar is added to a plot.

Examples

Run this code
#create a simple object of class 'asc'
tasc = as.asc(matrix(1:50,nr=50,nc=50)); print(tasc)

#plot the image
image(tasc,axes=FALSE,ann=FALSE)

#add a distance scalebar
Scalebar(x=5,y=5,distance=20) #show values in km
Scalebar(x=5,y=10,distance=20,unit='m',scale=1000) #show values in meters

Run the code above in your browser using DataLab