# NOT RUN {
library(sp)
data("nuts2006")
## Example 1
# Growth rate
nuts0.df$cagr <- (((nuts0.df$pop2008 / nuts0.df$pop1999)^(1/9)) - 1) * 100
# Countries plot
plot(nuts0.spdf, col = "grey60",border = "grey20", add=FALSE)
# Plot the symbols
propSymbolsChoroLayer(spdf = nuts0.spdf, df = nuts0.df,symbols = "circle",
var = "pop2008", var2 = "cagr")
## Example 2
# Share of farmers in Martinique
library(sf)
mtq <- st_read(system.file("shape/martinique.shp", package="cartography"))
mtq$shareCS1 <- 100 * mtq$C13_CS1/mtq$C13_POP
plot(st_geometry(mtq), col = "grey60",border = "white",
lwd=0.4, bg = "lightsteelblue1")
propSymbolsChoroLayer(x = mtq, var = "C13_POP", var2 = "shareCS1",
col = carto.pal(pal1 = "blue.pal", n1 = 3,
pal2 = "red.pal", n2 = 3),
inches = 0.2, method = "q6",
border = "grey50", lwd = 1,
legend.var.pos = "topright", legend.var2.pos = "left",
legend.var2.title.txt =
"Share of \nthe population\nworking in\nagriculture (%)",
legend.var.title.txt = "Population aged\n15 and over",
legend.var.style = "e")
# First layout
layoutLayer(title="Farmers in Martinique, 2013",
scale = NULL,col = NA, coltitle = "black",
author = "INSEE, 2016", sources = "",
frame = FALSE)
# }
Run the code above in your browser using DataLab