Dynamically defining map extents

Hello, I've defined the following function to dynamically define map extents
based on lon,lat input data. It is not very elegant or robust, but it does
seem to work. One issue, however, and it probably is related to something
else further down the chain... but every plot ends up being a different
size. So an improvement right off would be able to define a plot size (or at
least ratio, such that the limits would scale to the ratio). I would be
interested in comments on how to improve it.

def map_dynaMap((x,y)):
   """Sets a map region based on input data """

   ymin=min(y); ymax=max(y); y_edge=abs(ymax-ymin)*0.35
   xmin=min(x); xmax=max(x); x_edge=abs(xmax-xmin)*0.35

   llcrnrlat= ymin-y_edge
   if llcrnrlat<-90.: llcrnrlat=-90.
   llcrnrlon= xmin-x_edge
   if llcrnrlon<-180.: llcrnrlon=-180.
   urcrnrlat= ymax+y_edge
   if urcrnrlat>90.: urcrnrlat=90.
   urcrnrlon= xmax+x_edge
   if urcrnrlon>180.: urcrnrlon=180.


View this message in context: http://www.nabble.com/Dynamically-defining-map-extents-tp17835230p17835230.html
Sent from the matplotlib - users mailing list archive at Nabble.com.