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
# Growth rate at nuts2 level
nuts2.df$cagr <- (((nuts2.df$pop2008 / nuts2.df$pop1999)^(1/9)) - 1) * 100
# First layout
layoutLayer(title="Demographic trends, 1999-2008",
scale = NULL,col = NA, coltitle = "black",
sources = "", author = "",
frame = FALSE, bg = "#A6CAE0",
south = TRUE, extent = nuts0.spdf)
plot(world.spdf, col = "#E3DEBF", border=NA, add=TRUE)
plot(nuts2.spdf, col = "grey60",border = "white", lwd=0.4, add=TRUE)
# Add some NA values
nuts2.df[1:10,"pop2008"] <- NA
nuts2.df[100:110,"cagr"] <- NA
# Plot symbols
propSymbolsChoroLayer(spdf = nuts2.spdf, df = nuts2.df,
var = "pop2008", var2 = "cagr",
inches = 0.1,
col = carto.pal(pal1 = "blue.pal", n1 = 2,
pal2 = "red.pal", n2 = 4),
breaks = c(-2.43,-1,0,0.5,1,2,3.1),
border = "grey50", lwd = 1,
legend.var.pos = "topright", legend.var2.pos = "right",
legend.var2.title.txt = "Compound annual\ngrowth rate",
legend.var.title.txt = "Total Population",
legend.var.style = "e")
# Second layout
layoutLayer(title = "", author = "Eurostat, 2011",
sources = "", frame ="", col = NA)
Run the code above in your browser using DataLab