addscalebar | R Documentation |
Automatically determines the geographical scale of the plot and draws a labelled scalebar.
addscalebar( plotunit = NULL, plotepsg = NULL, widthhint = 0.25, unitcategory = "metric", htin = 0.1, padin = c(0.15, 0.15), style = "bar", bar.cols = c("black", "white"), lwd = 1, linecol = "black", tick.cex = 0.7, labelpadin = 0.08, label.cex = 0.8, label.col = "black", pos = "bottomleft" )
plotunit |
The unit which the current plot is plotted in, one of |
plotepsg |
The projection of the current plot. If extents are valid lat/lons, the projection is assumed to be lat/lon (EPSG:4326), or Spherical Mercator otherwise (EPSG:3857). This is done to work seamlessly with OpenStreetMap packages. |
widthhint |
The fraction of the plottable width which the scale bar should (mostly) occupy. |
unitcategory |
One of "metric" or "imperial" |
htin |
Height (in inches) of the desired scale bar |
padin |
A vector of length 2 determining the distance in inches between the scalebar and the edge of the plottable area. |
style |
One of "bar" or "ticks". |
bar.cols |
If |
lwd |
The line width to use when drawing the scalebar |
linecol |
The line color to use when drawing the scalebar |
tick.cex |
If |
labelpadin |
The distance between the end of the scalebar and the label (inches) |
label.cex |
The font size of the label |
label.col |
The color of the label |
pos |
Where to align the scalebar. One of "bottomleft", "bottomright", "topleft", or "topright". |
plot(1:5, 1:5, asp=1) addscalebar(plotunit="m") library(maptools) data(wrld_simpl) plot(wrld_simpl, xlim=c(-66.86, -59.75), ylim=c(43, 47.3)) #Nova Scotia addscalebar() #also works in non-lat/lon coordinate systems addscalebar(plotepsg=3395) #specify plot is in mercator projection addscalebar(plotepsg=26920) #specify plot is in UTM Zone 20N
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.