This function can be used to add a scale bar to a plot.
AddScaleBar(asp = 1, unit = NULL, is.lonlat = FALSE,
loc = c("bottomleft", "topleft", "topright", "bottomright"), offset = c(0,
0), lab.vert.exag = NULL)
'numeric'. y/x aspect ratio for spatial axes.
'character'. Axis unit of measurement, for example "METERS".
'logical'. If true, plot coordinates are in longitude and latitude.
'character'. Position of the scale bar in the plot region: "bottomleft", "topleft", "topright", or "bottomright" to denote scale location.
'numeric'. The x and y adjustments of the scale bar, in inches.
'logical'. If true, a label is drawn specifying the vertical exaggeration.
Used for the side-effect of a scale bar drawn on the current graphics device.
# NOT RUN {
plot(-100:100, -100:100, type = "n", xlab = "x", ylab = "y", asp = 2)
AddScaleBar(2, unit = "FEET", loc = "topleft")
AddScaleBar(2, unit = "METERS", loc = "bottomright", offset = c(-0.2, 0))
# }
Run the code above in your browser using DataLab