tanaka {tanaka} | R Documentation |
Plot a Tanaka Map
Description
This function plots a tanaka map.
Usage
tanaka(
x,
nclass = 8,
breaks,
col,
mask,
light = "#ffffff70",
dark = "#00000090",
shift,
legend.pos = "left",
legend.title = "Elevation",
add = FALSE
)
Arguments
x |
a raster or an sf contour layer (e.g. the result of
|
nclass |
a number of class. |
breaks |
a vector of break values. |
col |
a color palette (a vector of colors). |
mask |
a mask layer, a POLYGON or MULTIPOLYGON sf object. |
light |
light shadow (NW color). |
dark |
dark shadow (SE color). |
shift |
size of the shadow (in map units). |
legend.pos |
position of the legend, one of 'topleft', 'top', 'topright', 'right', 'bottomright', 'bottom', 'bottomleft', 'left' or a vector of two coordinates in map units (c(x, y)). If leg.position = NA then the legend is not plotted. If leg.position = 'interactive' click on the map to choose the legend position. |
legend.title |
title of the legend. |
add |
whether to add the layer to an existing plot (TRUE) or not (FALSE). |
Value
A Tanaka contour map is plotted.
References
Tanaka, K. (1950). The relief contour method of representing topography on maps. Geographical Review, 40(3), 444-456.
Examples
library(tanaka)
library(terra)
library(sf)
com <- st_read(system.file("gpkg/com.gpkg", package = "tanaka"),
quiet = TRUE
)
ras <- rast(system.file("tif/elev.tif", package = "tanaka"))
tanaka(ras)
tanaka(ras, mask = com)
tanaka(ras,
breaks = seq(80, 400, 20),
legend.pos = "topright",
legend.title = "Elevation\n(meters)"
)
tanaka(ras,
nclass = 15,
col = hcl.colors(15, "YlOrRd"),
legend.pos = "topright",
legend.title = "Elevation\n(meters)"
)