Revision: 8652 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8652&view=rev Author: efiring Date: 2010-08-21 17:49:53 +0000 (Sat, 21 Aug 2010)
Log Message: ----------- Axis.set_view_interval: when updating, respect original orientation Modified Paths: -------------- branches/v1_0_maint/CHANGELOG branches/v1_0_maint/lib/matplotlib/axis.py Modified: branches/v1_0_maint/CHANGELOG =================================================================== --- branches/v1_0_maint/CHANGELOG 2010-08-18 17:36:51 UTC (rev 8651) +++ branches/v1_0_maint/CHANGELOG 2010-08-21 17:49:53 UTC (rev 8652) @@ -1,3 +1,11 @@ +2010-08-21 Change Axis.set_view_interval() so that when updating an + existing interval, it respects the orientation of that + interval, and can enlarge but not reduce the interval. + This fixes a bug in which Axis.set_ticks would + change the view limits of an inverted axis. Whether + set_ticks should be affecting the viewLim at all remains + an open question. - EF + 2010-08-16 Handle NaN's correctly in path analysis routines. Fixes a bug where the best location for a legend was not calculated correctly when the line contains NaNs. - MGD Modified: branches/v1_0_maint/lib/matplotlib/axis.py =================================================================== --- branches/v1_0_maint/lib/matplotlib/axis.py 2010-08-18 17:36:51 UTC (rev 8651) +++ branches/v1_0_maint/lib/matplotlib/axis.py 2010-08-21 17:49:53 UTC (rev 8652) @@ -1696,11 +1696,21 @@ return self.axes.viewLim.intervalx def set_view_interval(self, vmin, vmax, ignore=False): + """ + If *ignore* is *False*, the order of vmin, vmax + does not matter; the original axis orientation will + be preserved. + """ if ignore: self.axes.viewLim.intervalx = vmin, vmax else: Vmin, Vmax = self.get_view_interval() - self.axes.viewLim.intervalx = min(vmin, Vmin), max(vmax, Vmax) + if Vmin < Vmax: + self.axes.viewLim.intervalx = (min(vmin, vmax, Vmin), + max(vmin, vmax, Vmax)) + else: + self.axes.viewLim.intervalx = (max(vmin, vmax, Vmin), + min(vmin, vmax, Vmax)) def get_minpos(self): return self.axes.dataLim.minposx @@ -1947,11 +1957,21 @@ return self.axes.viewLim.intervaly def set_view_interval(self, vmin, vmax, ignore=False): + """ + If *ignore* is *False*, the order of vmin, vmax + does not matter; the original axis orientation will + be preserved. + """ if ignore: self.axes.viewLim.intervaly = vmin, vmax else: Vmin, Vmax = self.get_view_interval() - self.axes.viewLim.intervaly = min(vmin, Vmin), max(vmax, Vmax) + if Vmin < Vmax: + self.axes.viewLim.intervaly = (min(vmin, vmax, Vmin), + max(vmin, vmax, Vmax)) + else: + self.axes.viewLim.intervaly = (max(vmin, vmax, Vmin), + min(vmin, vmax, Vmax)) def get_minpos(self): return self.axes.dataLim.minposy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins