Revision: 4779
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4779&view=rev
Author: mdboom
Date: 2007年12月20日 08:54:34 -0800 (2007年12月20日)
Log Message:
-----------
Minor speedup by not calculating the position of ticks/grids/text that
aren't there.
Modified Paths:
--------------
branches/transforms/lib/matplotlib/axis.py
Modified: branches/transforms/lib/matplotlib/axis.py
===================================================================
--- branches/transforms/lib/matplotlib/axis.py 2007年12月20日 13:01:07 UTC (rev 4778)
+++ branches/transforms/lib/matplotlib/axis.py 2007年12月20日 16:54:34 UTC (rev 4779)
@@ -94,14 +94,14 @@
self.label = self.label1 # legacy name
self.label2 = self._get_text2()
- self.update_position(loc)
-
self.gridOn = gridOn
self.tick1On = tick1On
self.tick2On = tick2On
self.label1On = label1On
self.label2On = label2On
+ self.update_position(loc)
+
def get_children(self):
children = [self.tick1line, self.tick2line, self.gridline, self.label1, self.label2]
return children
@@ -304,11 +304,16 @@
'Set the location of tick in data coords with scalar loc'
x = loc
- self.tick1line.set_xdata((x,))
- self.tick2line.set_xdata((x,))
- self.gridline.set_xdata((x, ))
- self.label1.set_x(x)
- self.label2.set_x(x)
+ if self.tick1On:
+ self.tick1line.set_xdata((x,))
+ if self.tick2On:
+ self.tick2line.set_xdata((x,))
+ if self.gridOn:
+ self.gridline.set_xdata((x,))
+ if self.label1On:
+ self.label1.set_x(x)
+ if self.label2On:
+ self.label2.set_x(x)
self._loc = loc
def get_view_interval(self):
@@ -420,13 +425,16 @@
def update_position(self, loc):
'Set the location of tick in data coords with scalar loc'
y = loc
- self.tick1line.set_ydata((y,))
- self.tick2line.set_ydata((y,))
- self.gridline.set_ydata((y, ))
-
- self.label1.set_y( y )
- self.label2.set_y( y )
-
+ if self.tick1On:
+ self.tick1line.set_ydata((y,))
+ if self.tick2On:
+ self.tick2line.set_ydata((y,))
+ if self.gridOn:
+ self.gridline.set_ydata((y, ))
+ if self.label1On:
+ self.label1.set_y( y )
+ if self.label2On:
+ self.label2.set_y( y )
self._loc = loc
@@ -1231,6 +1239,8 @@
for t in ticks:
t.tick1On = True
t.tick2On = True
+ for t in ticks:
+ t.update_position(t._loc)
def tick_top(self):
'use ticks only on top'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.