prettymap | R Documentation |
This function executes everything in plotexpression
, then draws
north arrow and scale bar using addnortharrow and addscalebar.
Specify that plot is in a non lat/lon projection by passing scale.plotepsg=...
or plotunit="m"
.
prettymap( plotexpression, oma = c(0, 0, 0, 0), mai = c(0, 0, 0, 0), drawbox = FALSE, box.lwd = 1, drawscale = TRUE, scale.pos = "bottomleft", scale.htin = 0.1, scale.widthhint = 0.25, scale.unitcategory = "metric", scale.style = "bar", scale.bar.cols = c("black", "white"), scale.lwd = 1, scale.linecol = "black", scale.padin = c(0.15, 0.15), scale.labelpadin = 0.08, scale.label.cex = 0.8, scale.label.col = "black", scale.plotunit = NULL, scale.plotepsg = NULL, scale.tick.cex = 0.8, drawarrow = FALSE, arrow.pos = "topright", arrow.scale = 1, arrow.padin = c(0.15, 0.15), arrow.lwd = 1, arrow.cols = c("white", "black"), arrow.border = "black", arrow.text.col = "black", title = NULL, ... )
plotexpression |
An expression to plot the map, can be in brackets. e.g.
|
oma |
A vector of length 4 describing the outer margin area. See documentation
for |
mai |
A vector of length 4 describing the margin area in inches. See documentation
for |
drawbox |
|
box.lwd |
The line width of the box |
drawscale |
|
scale.pos |
Where to align the scalebar. One of "bottomleft", "bottomright", "topleft", or "topright". |
scale.htin |
Height (in inches) of the desired scale bar |
scale.widthhint |
The fraction of the plottable width which the scale bar should (mostly) occupy. |
scale.unitcategory |
One of "metric" or "imperial" |
scale.style |
One of "bar" or "ticks". |
scale.bar.cols |
If |
scale.lwd |
The line width to use when drawing the scalebar |
scale.linecol |
The line color to use when drawing the scalebar |
scale.padin |
A vector of length 2 determining the distance in inches between the scalebar and the edge of the plottable area. |
scale.labelpadin |
The distance between the end of the scalebar and the label (inches) |
scale.label.cex |
The font size of the label |
scale.label.col |
The color of the label |
scale.plotunit |
The unit which the current plot is plotted in, one of |
scale.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. |
scale.tick.cex |
If |
drawarrow |
|
arrow.pos |
Where to align the north arrow. One of "bottomleft", "bottomright", "topleft", or "topright". |
arrow.scale |
Scale the default north arrow to make it bigger or smaller |
arrow.padin |
A vector of length 2 determining the distance in inches between the scalebar and the edge of the plottable area. |
arrow.lwd |
The line width outlining the north arrow |
arrow.cols |
A vector of length 2 determining the two colors to be drawn for the north arrow |
arrow.border |
The line color outlining the north arrow |
arrow.text.col |
Color of the "N" |
title |
Plot title, or |
... |
Further graphical parameters to set while executing plotting code |
prettymap(plot(1:5, 1:5, asp=1), scale.plotunit="cm", drawarrow=FALSE) #add a title prettymap(plot(1:5, 1:5, asp=1), title="My Plot") library(maptools) data(wrld_simpl) prettymap({plot(wrld_simpl, xlim=c(-66.86, -59.75), ylim=c(43, 47.3)) text(-62, 44, "Nova Scotia") text(-63, 47, "PEI")}, arrow.scale=1.1) #also works in non-lat/lon coordinate systems prettymap(plot(1:1000, 1:1000, asp=1), scale.plotepsg=26920, drawarrow=FALSE) #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.