popcircle package has been released on GitHub. This one-function package computes circles with areas scaled to a variable and displays them using a compact layout (higher values in the center, lower values at the periphery). Original polygons are scaled to fit inside these circles (size are roughly proportional, not strictly).
## Package install: library(remotes) install_github("rCarto/popcircle")
This is a typical example of the package usage based on the dataset shipped with the package. We use
cartography to display labels.
library(sf) library(popcircle) library(cartography) mtq <- st_read(system.file("gpkg/mtq.gpkg", package="popcircle")) res <- popcircle(x = mtq, var = "POP") circles <- res$circles shapes <- res$shapes par(mar = c(0,0,0,0)) plot(st_geometry(circles), col = "#bcd39c", border = "white", bg = "#eafdcf") plot(st_geometry(shapes), col = "#fffc99", border = "#fffc99", add = TRUE) labelLayer(x = circles[1:20,], txt = "LIBGEO", halo = TRUE, col ="#8e8358", cex = seq(.8,.4, length.out = 20), font = 2, bg = "white", r = .15, overlap = FALSE)
The next example was a bit more difficult to design. We had to work on some multipolygons countries (e.g. France, USA or Russia) in order to keep only the largest polygon.
sf objects it is possible to display them interactively:
popcircle changes the position of spatial units. It will work better with regions already well known to the target audience. Chances are that the first figure on Martinique municipalities will be more appropriate and effective for the inhabitants of Martinique.