Exercise

Proportional Symbol Map of Households w/ Internet

To map a raw count variable, you can use a proportional symbol map to create markers of sizes that are proportional to the data value being mapped. In this exercise you will find the centroid of each state, create a basemap of states, and place a circle at each centroid that is sized by the number of households with internet access.

The area of each marker should be proportional to the data value. Since marker sizes are provided as a diameter, you must take the square root of the column value. Marker sizes may look too big or too small. In this exercise, you will divide the marker size by 5--this is an aesthetic judgment call.

geopandas is imported using the usual alias, and the sqrt function has been imported from numpy.

The geo_state GeoDataFrame has been loaded.

Instructions

100 XP
  • Call the centroid attribute on geo_state_pt and assign the result to the geometry column
  • Create a basemap of state borders by calling the plot method on geo_state; set the color to "tan" and the edgecolor to "black"
  • Create variable ms (to be passed to the markersize parameter) to the square root of the value of the geo_state_pt["internet"] column divided by 5