County-level election results
- Simple Features: documentation
- Geocode via ggmap: documentation
- Albers USA: hrbrmstr/albersusa
- Election results 2016: mkearney/presidential_election_county_results_2016
- Colors: Paletton - tool for finding complimentary colors
- Colors: ColorBrewer - perceptually uniform color scales for maps
- Colors: Colour Lovers - most "loved" color palettes
- Colors: Sswat.ch - curated palettes sourced from Dribbble
Use ScapeToad to create a county-level election cartogram, with the areas scaled by the number of votes.
Due: 6-Feb-2018 before the start of class (optional)
2016 U.S. presidential election cartogram
Begin by exporting the election map we made in class, either the simple red-blue map or the one that scales by vote margin. Remember to transform the coordinates to WGS 84 (crs code 4326) before exporting.
st_transform(st_as_sf(elecjoin),crs = 4326) %>%
st_write("election-map.shp", driver = "ESRI Shapefile")
Download ScapeToad, a simple application for making cartograms. There is no installation required. Just download the .zip, unpack the contents, and run the ScapeToad.exe executable.
ScapeToad is very easy to use. Just import the shapefile layer, press the Create Cartogram button, and follow the instructions.
- Section 1: skip
- Section 2: "Spatial coverage" = the shapefile you just imported
- Section 3: "Cartogram attribute" = total votes ("ttl_vts") / "Attribute type" = Mass
- Section 4: skip
- Section 5: you can refine the quality of the transformation here, or just use the default settings
Once ScapeToad finishes, export the transformed cartogram. Load it into R using "st_read()" and set the CRS to WGS 84.
cartogram <- st_read('election-cartogram.shp', stringsAsFactors = FALSE)
st_crs(cartogram) = 4326
Now you can plot it as you did the original election map.

