legendBarsSymbols | R Documentation |
Plot legend for proportional bars maps
legendBarsSymbols(
pos = "topleft",
title.txt = "Title of the legend",
title.cex = 0.8,
cex = 1,
border = "black",
lwd = 1,
values.cex = 0.6,
var,
inches,
col = "red",
frame = FALSE,
values.rnd = 0,
style = "c"
)
pos |
position of the legend, one of "topleft", "top", "topright", "right", "bottomright", "bottom", "bottomleft", "bottomleftextra", "left" or a vector of two coordinates in map units (c(x, y)). |
title.txt |
title of the legend. |
title.cex |
size of the legend title. |
cex |
size of the legend. 2 means two times bigger. |
border |
color of the borders. |
lwd |
width of the borders. |
values.cex |
size of the values in the legend. |
var |
vector of values (at least min and max). |
inches |
height of the higher bar. |
col |
color of symbols. |
frame |
whether to add a frame to the legend (TRUE) or not (FALSE). |
values.rnd |
number of decimal places of the values in the legend. |
style |
either "c" or "e". The legend has two display styles, "c" stands for compact and "e" for extended. |
library(sf)
mtq <- st_read(system.file("gpkg/mtq.gpkg", package="cartography"))
plot(st_geometry(mtq))
box()
legendBarsSymbols(pos = "topleft", title.txt = "Title of\nthe legend",
title.cex = 0.8, values.cex = 0.6,cex = 1,
var = c(min(mtq$POP),max(mtq$POP)),
inches = 0.5,
col = "purple",
values.rnd=0, style ="e")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.