|
From: <ds...@us...> - 2007-07-16 14:07:01
|
Revision: 3539
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3539&view=rev
Author: dsdale
Date: 2007-07-16 07:06:59 -0700 (Mon, 16 Jul 2007)
Log Message:
-----------
fixed a formatting bug in ticker.ScalarFormatter (10^0 was rendered as
10 in some cases)
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2007-07-16 13:16:25 UTC (rev 3538)
+++ trunk/matplotlib/CHANGELOG 2007-07-16 14:06:59 UTC (rev 3539)
@@ -1,3 +1,6 @@
+2007-07-16 fixed a formatting bug in ticker.ScalarFormatter's scientific
+ notation (10^0 was being rendered as 10 in some cases) - DSD
+
2007-07-13 Add MPL_isfinite64() and MPL_isinf64() for testing
doubles in (the now misnamed) MPL_isnan.h. - ADS
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2007-07-16 13:16:25 UTC (rev 3538)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2007-07-16 14:06:59 UTC (rev 3539)
@@ -402,27 +402,26 @@
if absolute(xp) < 1e-8: xp = 0
return self.format % xp
- def _formatSciNotation(self,s, mathtext=False):
+ def _formatSciNotation(self, s, mathtext=False):
# transform 1e+004 into 1e4, for example
tup = s.split('e')
try:
- mantissa = tup[0].rstrip('0').rstrip('.')
+ significand = tup[0].rstrip('0').rstrip('.')
sign = tup[1][0].replace('+', '')
exponent = tup[1][1:].lstrip('0')
if mathtext:
- if self._usetex:
- if mantissa=='1':
- return r'10^{%s%s}'%(sign, exponent)
- else:
- return r'%s{\times}10^{%s%s}'%(mantissa, sign, exponent)
+ if significand == '1':
+ # reformat 1x10^y as 10^y
+ significand = ''
+ if exponent:
+ exponent = '10^{%s%s}'%(sign, exponent)
+ if significand and exponent:
+ return r'%s{\times}%s'%(significand, exponent)
else:
- if mantissa=='1':
- return r'10^{%s%s}'%(sign, exponent)
- else:
- return r'%s{\times}10^{%s%s}'%(mantissa, sign, exponent)
+ return r'%s%s'%(significand, exponent)
else:
- return ('%se%s%s' %(mantissa, sign, exponent)).rstrip('e')
- except IndexError,msg:
+ return ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
+ except IndexError, msg:
return s
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|