Learn R Programming

cartography (version 1.3.0)

legendSquaresSymbols: Legend for Proportional Squares Maps

Description

Plot legend for proportional squares maps

Usage

legendSquaresSymbols(pos = "topleft", title.txt = "Title of the legend", title.cex = 0.8, cex = 1, values.cex = 0.6, var, r, breakval = NULL, col = "red", col2 = "blue", frame = FALSE, values.rnd = 0, style = "c")

Arguments

pos
position of the legend, one of "topleft", "top", "topright", "left", "right", "bottomleft", "bottom", "bottomright".
title.txt
title of the legend.
title.cex
size of the legend title.
cex
size of the legend. 2 means two times bigger.
values.cex
size of the values in the legend.
var
vector of values.
r
a vector giving the length of the sides of the squares.
breakval
breaking value (see Details).
col
color of symbols.
col2
second color of symbols (see Details).
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.

Details

The breakval parameter allows to plot symbols of two colors: the first color (col) for values superior or equal to breakval, second color (col2) for values inferior to breakval.

Examples

Run this code
data("nuts2006")
plot(nuts0.spdf)
rect(par()$usr[1], par()$usr[3], par()$usr[2], par()$usr[4], border = "black")
legendSquaresSymbols(pos = "bottomright", title.txt = "Title of\nthe legend ",
                     title.cex = 0.8, values.cex = 0.6,
                     var = nuts1.df$pop2008,
                     r = sqrt((abs(nuts1.df$pop2008) * 5000)),
                     breakval=10, col="red", col2="blue", 
                     frame=TRUE, values.rnd=0, style ="c")

Run the code above in your browser using DataLab