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,
...
)
An expression to plot the map, can be in brackets. e.g.
plot(stuff); text(places, "readme!")
or {plot(stuff);
text(places, "readme!")}
A vector of length 4 describing the outer margin area. See documentation
for graphics::par
.
A vector of length 4 describing the margin area in inches. See documentation
for graphics::par
.
TRUE
if box should be drawn around map, FALSE
otherwise.
The line width of the box
TRUE
if scalebar should be drawn, FALSE
otherwise.
Where to align the scalebar. One of "bottomleft", "bottomright", "topleft", or "topright".
Height (in inches) of the desired scale bar
The fraction of the plottable width which the scale bar should (mostly) occupy.
One of "metric" or "imperial"
One of "bar" or "ticks".
If style=="bar"
, the colors to be repeated to make the bar.
The line width to use when drawing the scalebar
The line color to use when drawing the scalebar
A vector of length 2 determining the distance in inches between the scalebar and the edge of the plottable area.
The distance between the end of the scalebar and the label (inches)
The font size of the label
The color of the label
The unit which the current plot is plotted in, one of cm
,
m
, km
, in
, ft
, mi
. or latlon
. This
parameter is optional if plotepsg
is passed.
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.
If style=="ticks"
, the height of interior ticks.
TRUE
if north arrow should be drawn, FALSE
otherwise
Where to align the north arrow. One of "bottomleft", "bottomright", "topleft", or "topright".
Scale the default north arrow to make it bigger or smaller
A vector of length 2 determining the distance in inches between the scalebar and the edge of the plottable area.
The line width outlining the north arrow
A vector of length 2 determining the two colors to be drawn for the north arrow
The line color outlining the north arrow
Color of the "N"
Plot title, or NULL
if none is desired.
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")
Run the code above in your browser using DataLab