From: <jd...@us...> - 2007-09-28 12:41:15
|
Revision: 3898 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3898&view=rev Author: jdh2358 Date: 2007-09-28 05:41:08 -0700 (Fri, 28 Sep 2007) Log Message: ----------- fixed some tick accessor bugs Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axis.py trunk/matplotlib/lib/matplotlib/widgets.py Modified: trunk/matplotlib/lib/matplotlib/axis.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axis.py 2007-09-26 14:08:12 UTC (rev 3897) +++ trunk/matplotlib/lib/matplotlib/axis.py 2007-09-28 12:41:08 UTC (rev 3898) @@ -519,8 +519,11 @@ def get_children(self): children = [self.label] - children.extend(self.majorTicks) - children.extend(self.minorTicks) + majorticks = self.get_major_ticks() + minorticks = self.get_minor_ticks() + + children.extend(majorticks) + children.extend(minorticks) return children def cla(self): @@ -643,7 +646,8 @@ def get_gridlines(self): 'Return the grid lines as a list of Line2D instance' - return silent_list('Line2D gridline', [tick.gridline for tick in self.majorTicks]) + ticks = self.get_major_ticks() + return silent_list('Line2D gridline', [tick.gridline for tick in ticks]) def get_label(self): 'Return the axis label as a Text instance' @@ -659,14 +663,16 @@ def get_ticklabels(self): 'Return a list of Text instances for ticklabels' - labels1 = [tick.label1 for tick in self.majorTicks if tick.label1On] - labels2 = [tick.label2 for tick in self.majorTicks if tick.label2On] + ticks = self.get_major_ticks() + labels1 = [tick.label1 for tick in ticks if tick.label1On] + labels2 = [tick.label2 for tick in ticks if tick.label2On] return silent_list('Text ticklabel', labels1+labels2) def get_ticklines(self): 'Return the ticklines lines as a list of Line2D instance' lines = [] - for tick in self.majorTicks: + ticks = self.get_major_ticks() + for tick in ticks: lines.append(tick.tick1line) lines.append(tick.tick2line) return silent_list('Line2D ticklines', lines) @@ -1081,9 +1087,10 @@ """ assert position == 'top' or position == 'bottom' or position == 'both' or position == 'default' - ticks = list(self.majorTicks) # a copy - ticks.extend( self.minorTicks ) + ticks = list( self.get_major_ticks() ) # a copy + ticks.extend( self.get_minor_ticks() ) + if position == 'top': for t in ticks: t.tick1On = False @@ -1277,8 +1284,8 @@ """ assert position == 'left' or position == 'right' or position == 'both' or position == 'default' - ticks = list(self.majorTicks) # a copy - ticks.extend( self.minorTicks ) + ticks = list( self.get_major_ticks() ) # a copy + ticks.extend( self.get_minor_ticks() ) if position == 'right': self.set_offset_position('right') Modified: trunk/matplotlib/lib/matplotlib/widgets.py =================================================================== --- trunk/matplotlib/lib/matplotlib/widgets.py 2007-09-26 14:08:12 UTC (rev 3897) +++ trunk/matplotlib/lib/matplotlib/widgets.py 2007-09-28 12:41:08 UTC (rev 3898) @@ -971,14 +971,14 @@ print ' endposition : (%f, %f)' % (erelease.xdata, erelease.ydata) print ' used button : ', eclick.button - def toggle_Selector(event): + def toggle_selector(event): print ' Key pressed.' - if event.key in ['Q', 'q'] and toggle_Selector.RS.active: + if event.key in ['Q', 'q'] and toggle_selector.RS.active: print ' RectangleSelector deactivated.' - toggle_Selector.RS.set_active(False) - if event.key in ['A', 'a'] and not toggle_Selector.RS.active: + toggle_selector.RS.set_active(False) + if event.key in ['A', 'a'] and not toggle_selector.RS.active: print ' RectangleSelector activated.' - toggle_Selector.RS.set_active(True) + toggle_selector.RS.set_active(True) x = arange(100)/(99.0) y = sin(x) @@ -986,8 +986,8 @@ ax = subplot(111) ax.plot(x,y) - toggle_Selector.RS = RectangleSelector(ax, onselect, drawtype='line') - connect('key_press_event', toggle_Selector) + toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='line') + connect('key_press_event', toggle_selector) show() """ def __init__(self, ax, onselect, drawtype='box', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |