This function creates a legend object that can be attached to a data layer.
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
)
an object layerlegend
which can be passed to an spLayer*
function through the legend
argument.
the style of legend to generate.
Can be one of "points
", "lines
", "polygons
", "icons
", "gradient
".
a vector to label each element of the legend.
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.
a character string indicating where should the legend be displayed.
This must be one of "topleft
", "topright
", "bottomleft
", "bottomright
", "none
"
character vector giving the paths for the PNG icons. If NULL
(default), circles are drawn.
a numerical vector giving the size of points (radius in pixels).
numerical vectors giving the PNG icons dimensions on the map (in pixels).
a vector of any of the three kinds of R color specifications to set strokes color.
a numerical vector to set strokes width.
a character vector that defines the strokes dash patterns (See Details).
a vector of numeric values in \([0, 1]\) setting strokes opacity.
a vector of any of the three kinds of R color specifications to set fill colors.
a vector of numeric values in \([0, 1]\) setting fill opacity.
range of gradient values.
a vector of any of the three kinds of R color specifications giving the colors of the gradient.
a vector of numeric values in \([0, 1]\) setting the gradient opacity.