tanaka: Plot a Tanaka Map

View source: R/tanaka.R

tanakaR 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 tanaka_contour(), "min" and "max" columns are needed).

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 legend.pos="n" then the legend is not plotted.

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)"
)

tanaka documentation built on July 4, 2022, 5:08 p.m.