From: <js...@us...> - 2009-03-06 19:13:56
|
Revision: 6958 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6958&view=rev Author: jswhit Date: 2009-03-06 19:13:45 +0000 (Fri, 06 Mar 2009) Log Message: ----------- add fix_aspect kwarg - when False, plot will not be forced to match aspect ratio of map region. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2009-03-05 13:22:26 UTC (rev 6957) +++ trunk/toolkits/basemap/Changelog 2009-03-06 19:13:45 UTC (rev 6958) @@ -1,4 +1,8 @@ version 0.99.4 (not yet released) + * add fix_aspect kwarg to Basemap.__init__, when true + axes.set_aspect is set to 'auto' instead of default 'equal'. + Can be used to make plot fill whole plot region, even if the + plot region doesn't match the aspect ratio of the map region. * added date2index function, updated netcdftime to 0.7.1. * added maskoceans function. * update pupynere to version 1.0.8 (supports writing large files). Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-03-05 13:22:26 UTC (rev 6957) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-03-06 19:13:45 UTC (rev 6958) @@ -242,6 +242,8 @@ formatter, or if you want to let matplotlib label the axes in meters using map projection coordinates. + fix_aspect fix aspect ratio of plot to match aspect ratio + of map projection region (default True). anchor determines how map is placed in axes rectangle (passed to axes.set_aspect). Default is ``C``, which means map is centered. @@ -434,10 +436,14 @@ suppress_ticks=True, satellite_height=35786000, boundinglat=None, + fix_aspect=True, anchor='C', ax=None): # docstring is added after __init__ method definition + # fix aspect to ratio to match aspect ratio of map projection + # region + self.fix_aspect = fix_aspect # where to put plot in figure (default is 'C' or center) self.anchor = anchor # map projection. @@ -2566,7 +2572,10 @@ # make sure aspect ratio of map preserved. # plot is re-centered in bounding rectangle. # (anchor instance var determines where plot is placed) - ax.set_aspect('equal',adjustable='box',anchor=self.anchor) + if self.fix_aspect: + ax.set_aspect('equal',adjustable='box',anchor=self.anchor) + else: + ax.set_aspect('auto',adjustable='box',anchor=self.anchor) ax.apply_aspect() # make sure axis ticks are turned off. if self.noticks: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |