layerLegend: Data layer legend

View source: R/legend.R

layerLegendR Documentation

Data layer legend

Description

This function creates a legend object that can be attached to a data layer.

Usage

layerLegend(
  style,
  labels = "",
  title = NULL,
  position = "bottomright",
  png = NULL,
  size = 5,
  png.width = NULL,
  png.height = NULL,
  stroke.col = 1,
  stroke.lwd = 1,
  stroke.lty = -1,
  stroke.alpha = 1,
  fill.col = 2,
  fill.alpha = 0.5,
  cells.range = c(1, 10),
  cells.col = heat.colors(12),
  cells.alpha = 1
)

Arguments

style

the style of legend to generate. Can be one of "points", "lines", "polygons", "icons", "gradient".

labels

a vector to label each element of the legend.

title

a title which will appear above the legend. If NULL (default), it will inherit the name of the data layer during the compilation of the map. If NA, the legend will appear without title.

position

a character string indicating where should the legend be displayed. This must be one of "topleft", "topright", "bottomleft", "bottomright", "none"

png

character vector giving the paths for the PNG icons. If NULL (default), circles are drawn.

size

a numerical vector giving the size of points (radius in pixels).

png.width, png.height

numerical vectors giving the PNG icons dimensions on the map (in pixels).

stroke.col

a vector of any of the three kinds of R color specifications to set strokes color.

stroke.lwd

a numerical vector to set strokes width.

stroke.lty

a character vector that defines the strokes dash patterns (See Details).

stroke.alpha

a vector of numeric values in [0, 1] setting strokes opacity.

fill.col

a vector of any of the three kinds of R color specifications to set fill colors.

fill.alpha

a vector of numeric values in [0, 1] setting fill opacity.

cells.range

range of gradient values.

cells.col

a vector of any of the three kinds of R color specifications giving the colors of the gradient.

cells.alpha

a vector of numeric values in [0, 1] setting the gradient opacity.

Value

an object layerlegend which can be passed to an spLayer* function through the legend argument.


rleafmap documentation built on Oct. 20, 2023, 5:08 p.m.