Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82e1cb4

Browse files
committed
Minor speed improvement for NewScalarFormatter
svn path=/trunk/matplotlib/; revision=1263
1 parent 9ef6027 commit 82e1cb4

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

lib/matplotlib/ticker.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,6 @@ def __call__(self, x, pos=0):
263263
if self.locs==None:
264264
return ''
265265
else:
266-
self.verify_intervals()
267-
d = abs(self.viewInterval.span())
268-
if self._useOffset: self._set_offset(d)
269-
self._set_orderOfMagnitude(d)
270-
self._set_format()
271266
return self.pprint_val(x)
272267

273268
def format_data(self,value):
@@ -292,7 +287,14 @@ def get_offset(self):
292287
else: return ''
293288

294289
def set_locs(self, locs):
290+
'set the locations of the ticks'
295291
self.locs = locs
292+
if self.locs != None:
293+
self.verify_intervals()
294+
d = abs(self.viewInterval.span())
295+
if self._useOffset: self._set_offset(d)
296+
self._set_orderOfMagnitude(d)
297+
self._set_format()
296298

297299
def _set_offset(self, range):
298300
# offset of 20,001 is 20,000, for example

0 commit comments

Comments
 (0)