Choropleth maps
Choropleth maps also show concentration, however, they use different shades of color to show concentration. This method is useful if related data spans multiple polygons. For example, in a worldwide population density map by country, many countries have disconnected polygons (for example, Hawaii is an island state of the U.S.). In this example, we'll use the Python Imaging Library (PIL) discussed in Chapter 3, The Geospatial Technology Landscape. PIL is not purely Python, but it is designed specifically for Python. We'll recreate our previous dot density example as a choropleth map. We'll calculate a density ratio for each census tract based on the number of people (population) per square kilometer and use that value to adjust the color. The dark areas are more densely populated and the lighter ones are less densely populated, as shown here:
import math import shapefile try: import Image import ImageDraw except: from PIL import Image, ImageDraw def world2screen...