Hi, You can also use the 'maps' package for the map data and the 'scales' package for the color mapping.
E.g. library(maps) library(scales) m <- map('state', fill=TRUE, plot=FALSE) s_data <- tolower(rownames(USArrests)) s_map <- tolower(m$names) mapping <- lapply(s_data, function(state) { which(grepl(state, s_map)) }) ## check if the mapping is good! col_pal <- col_numeric("Greens", domain=NULL, na.color = 'lightyellow') cols <- rep('lightyellow', length(s_data)) Map(function(indices, col) { cols[indices] <<- col }, mapping, col_pal(USArrests$UrbanPop)) map(m, col=cols, fill=TRUE) Adrian On Mon, Dec 7, 2015 at 9:34 AM, Erich Neuwirth <erich.neuwi...@univie.ac.at> wrote: > ggplot2 also can do this with > fortify > geom_polygon > > Von meinem iPad gesendet > >> Am 06.12.2015 um 21:03 schrieb Benjamin Tyner <bty...@gmail.com>: >> >> Hi >> >> I wish to draw a basic choropleth (US, by state) and am wondering if anyone >> has any recommendations? I've tried the following thus far: >> >> 1. choroplethr: this works, but required installation of 30+ dependencies. I >> would prefer something with fewer dependencies. >> 2. tmap: this also seems promising, but most of the examples I saw were >> specific to European maps. Can it be adapted for US? >> 3. statebins: doesn't draw true choropleths, but I liked that it doesn't >> have many dependencies. >> >> Regards >> Ben >> >> ______________________________________________ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.