I did some more digging and I think I have a hypothesis
for what is happening.
There is only one main difference between a call to .drawstates() and
.readshapefiles() with respect to loading and plotting data.
.drawstates() loads only the line segments that coincide with the
defined map boundaries, while .readshapefiles() loads all of the data
in the shapefile. Therefore, the LineCollection that gets attached to
the axis contains data from outside the stated domain.
In addition, the basemap versions of the plotting functions have the
benefit of finishing their calls with a call to .set_axes_limits(),
which keeps the axes in check. However, a non-basemap version would
not call that automatically, thereby having its axes automatically
expanded to contain all of the data in the LineCollection.
I am not sure what exactly should be done about this. This is
certainly un-intuitive behavior, though. Maybe there could be a keyword
option in .readshapefile() to have only the data for the stated domain
loaded? That might solve the issue.
Ben: That’s why you should use the basemap methods where possible
(they handle these things for you). You could also turn autoscaling
off on your axes using
and then they won’t automatically expand when you plot data outside
your map region. Or, you could just call the set_axes_limits() methods
before you draw the plot.
Clipping the polygons to the map projection region is non-trivial, and
I don’t think I want to add that to readshapefile.
-- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web :