Learn R Programming

inlmisc (version 0.5.5)

AddNorthArrow: Add North Arrow to Plot

Description

Add a north arrow aligned to true north to a plot.

Usage

AddNorthArrow(crs = sp::CRS(), len = 0.05, lab = "N", rotate = 0, ...)

Arguments

crs

'CRS', 'Raster*', or 'Spatial'. Coordinate reference system (CRS), or any object with a CRS attribute that can be extracted using the crs function. If missing (the default) the north arrow is point to the top of the plot unless the rotate argument is specified.

len

'numeric' number. Arrow length expressed as a fraction of the plot height, by default is 5-percent.

lab

'character' string. North label, by default is “N”.

rotate

'numeric' number. Arrow offset-rotation in degrees, where positive values are taken to be clockwise.

...

Additional arguments to be passed to the GetInsetLocation function---used to position the north arrow in the main plot region.

Value

Invisible NULL

See Also

PlotMap

Examples

Run this code
# NOT RUN {
m <- datasets::volcano
m <- m[nrow(m):1, ncol(m):1]
x <- seq(from = 2667405, length.out = ncol(m), by = 10)
y <- seq(from = 6478705, length.out = nrow(m), by = 10)
r <- raster::raster(m, xmn = min(x), xmx = max(x),
                    ymn = min(y), ymx = max(y),
                    crs = "+init=epsg:27200")
PlotMap(r, pal = GetColors(scheme = "DEM screen"))
AddNorthArrow(raster::crs(r), loc = "center")
AddNorthArrow(raster::crs(r), inset = 0.1)
AddNorthArrow(raster::crs(r), loc = "topleft", inset = 0.1)

# }

Run the code above in your browser using DataLab