Does anybody know how to plot any attribute of a shapefile with R?
For example, like this.
If you are looking for an interactive graphical view, mapview is the right choice. Use
## load packages library(raster) library(mapview) ## download data esp <- getData(country = "COL", level = 1) ## interactive plot mapview(esp)
to display clickable polygons with a popup window showing you all the attribute values associated with a particular polygon. The package also features a version of
spplot to display maps created via
mapview statically (note that the function is still under heavy development).
## static plot m <- mapview(esp) spplot(m, zcol = "NAME_1", zoom = 6, colorkey = FALSE, scales = list(draw = TRUE))