[Matplotlib-users] Basemap and counties

Tommy Grav tgrav at me.com
Wed Aug 19 17:07:30 CEST 2015

I am trying to use matplotlib and basemap to show a map of the State of Indiana and highlight a few 
different counties. As a newbie I started with the code below, but I am having trouble with how to identify 
and fill specific counties. Anyone have any suggestions?

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np

# make sure the value of resolution is a lowercase L,
#  for 'low', not a numeral 1
map = Basemap(projection='merc', lat_0=39.1622, lon_0=-86.5292,
   resolution = 'h', area_thresh = 0.1,
   llcrnrlon=-88.53, llcrnrlat=37.16,
   urcrnrlon=-84.53, urcrnrlat=41.16)

map.drawstates(linewidth=0.5, linestyle="solid", color="r", antialiased=1, ax=None, zorder=None)
map.drawcounties(linewidth=0.1,linestyle="solid", color="k", antialiased=1,
                ax=None, zorder=None, drawbounds=False)

map.drawmeridians(np.arange(0, 360, 30))
map.drawparallels(np.arange(-90, 90, 30))


More information about the Matplotlib-users mailing list