add_legend: Create and plot a continuous color legend

Description Usage Arguments

View source: R/figures_maps.R

Description

Create and plot a continuous color legend

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
add_legend(
  zlim,
  zextreme,
  col_desc,
  grid,
  box = c(-100, -97, -50, -10),
  whitebox = TRUE,
  horiz = FALSE,
  signed = 1,
  fun_inv_ens = NULL,
  at = NULL,
  tick = TRUE,
  labels = TRUE,
  srt = 90,
  cex = 1
)

Arguments

zlim

A numeric vector of length two. The smallest and largest z-value of grid for which a complete color gradient and legend should be printed.

zextreme

A numeric vector length two. The minimum and maximum z-value of grid. If zextreme[1] < zlim[1] || zextreme[2] > zlim[2], then the values in the ranges between each zextreme and zlim will be highlighted as extreme areas in a different color.

col_desc

A list with the color names. A returned object from a call to the function prepare_colors.

grid

A raster::RasterLayer object for which the legend is created.

box

A numeric vector of length four. The SW (lower left) and NE (upper right) corners of the color legend on the plotted grid.

whitebox

A logical value. If TRUE, then the area of the color legend is printed white before the colors of the legend are added.

horiz

A logical value. If TRUE, then the values of the color legend are printed below the legend box; if FALSE, then the values are printed on the right side of the box.

signed

A numeric value. A scaling value multiplied with the z-values for determining legend values.

fun_inv_ens

A function or NULL. If a function, then it will be applied to z-values for determining legend values.

at

The points at which tick-marks are to be drawn. By default (when NULL) tickmark locations are computed, see axis.

tick

A logical value. Indicates whether or not tickmarks should be added to the legend color ramp.

labels

The annotations to be written at the tick-marks, see axis.

srt

A numerical value. String rotation in degrees, see text.

cex

A numerical value. Numeric character expansion factor, see text.


DrylandEcology/rSW2analysis documentation built on Nov. 8, 2021, 4:20 p.m.