From: <ef...@us...> - 2008-04-21 08:00:17
|
Revision: 5054 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5054&view=rev Author: efiring Date: 2008-04-21 01:00:03 -0700 (Mon, 21 Apr 2008) Log Message: ----------- Support 0-centered axis in MaxNLocator Modified Paths: -------------- trunk/matplotlib/API_CHANGES trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/ticker.py Modified: trunk/matplotlib/API_CHANGES =================================================================== --- trunk/matplotlib/API_CHANGES 2008-04-20 10:45:32 UTC (rev 5053) +++ trunk/matplotlib/API_CHANGES 2008-04-21 08:00:03 UTC (rev 5054) @@ -1,5 +1,8 @@ + New kwarg, "symmetric", in MaxNLocator + allows one require an axis to be centered on zero. + toolkits must now be imported from mpl_toolkits (not matplotlib.toolkits) - + TRANSFORMS REFACTORING The primary goal of this refactoring was to make it easier to Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-20 10:45:32 UTC (rev 5053) +++ trunk/matplotlib/CHANGELOG 2008-04-21 08:00:03 UTC (rev 5054) @@ -1,3 +1,5 @@ +2008-04-20 Add support to MaxNLocator for symmetric axis autoscaling. - EF + 2008-04-20 Fix double-zoom bug. - MM 2008-04-15 Speed up color mapping. - EF Modified: trunk/matplotlib/lib/matplotlib/ticker.py =================================================================== --- trunk/matplotlib/lib/matplotlib/ticker.py 2008-04-20 10:45:32 UTC (rev 5053) +++ trunk/matplotlib/lib/matplotlib/ticker.py 2008-04-21 08:00:03 UTC (rev 5054) @@ -845,10 +845,14 @@ Select no more than N intervals at nice locations. """ - def __init__(self, nbins = 10, steps = None, trim = True, integer=False): + def __init__(self, nbins = 10, steps = None, + trim = True, + integer=False, + symmetric=False): self._nbins = int(nbins) self._trim = trim self._integer = integer + self._symmetric = symmetric if steps is None: self._steps = [1, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10] else: @@ -890,6 +894,10 @@ def autoscale(self): dmin, dmax = self.axis.get_data_interval() + if self._symmetric: + maxabs = max(abs(dmin), abs(dmax)) + dmin = -maxabs + dmax = maxabs dmin, dmax = mtransforms.nonsingular(dmin, dmax, expander = 0.05) return npy.take(self.bin_boundaries(dmin, dmax), [0,-1]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |