I'm using Basemap to display the East Coast of the US and the Atlantic Ocean. Shapefile is used to read a shapefile the contents of which is loaded into a PyPlot subplot hosted Line Collection which overlays the ocean with a series of closed polygons. PyPlot text is used to label each polygon with it's designator.
I have two questions both of which involve the polygons I'm loading from the shapefile.
1.) In order to simplify polygon\shoreline intersections the sides of the polygons were brought onto shore to close the polygon. How do I make these lines not show up on the land portion of the basemap? I tried zorder but it didn't seem to make a difference.
2.) Is there a way to color fill the polygons being created in the LineCollection?
Thank you for the assist. PNG available by PM if needed.
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from matplotlib import cm
from mpl_toolkits.basemap import Basemap
fig = plt.figure(figsize=(11.7,8.3))
#Custom adjust of the subplots
ax = plt.subplot(111)
#Let's create a basemap of the Northeast Region
x1 = -78.
x2 = -64.
y1 = 34.
y2 = 46.
m = Basemap(resolution='i',projection='merc', llcrnrlat=y1,urcrnrlat=y2,llcrnrlon=x1,urcrnrlon=x2,lat_ts=(x1+x2)/2)
m.drawcountries(linewidth=0.5,zorder = 10)
m.drawcoastlines(linewidth=0.5,zorder = 11)
m.drawstates(linewidth=0.5,zorder = 12)
sf = shapefile.Reader("c:\\temp\\US_Stat_Areas_no_Coastline\\US_Stat_Areas_no_Coastline")
shapeRecs = sf.shapeRecords()
centroids = 
for area in shapeRecs:
shpsegs = 
shpinfo = 
points = 
stat_area = area.record
if int(stat_area) > 700:
if int(stat_area) <= 463:
print "Processing Stat Area: %s" % stat_area
vertices = area.shape.points
lons = 
lats = 
for each_vertice in vertices:
x, y = m(lons, lats)
shpseg = zip(x,y)
for point in shpseg:
lines = LineCollection(shpsegs,antialiaseds=(1,),zorder = 5)