Menu

Commit [r2298]  Maximize  Restore  History

fixed a bug in scalarformatter's get_offset

dsdale 2006-04-18

changed /trunk/matplotlib/examples/newscalarformatter_demo.py
changed /trunk/matplotlib/lib/matplotlib/ticker.py
/trunk/matplotlib/examples/newscalarformatter_demo.py Diff Switch to side-by-side view
--- a/trunk/matplotlib/examples/newscalarformatter_demo.py
+++ b/trunk/matplotlib/examples/newscalarformatter_demo.py
@@ -20,6 +20,8 @@
 gca().yaxis.set_major_formatter(OldScalarFormatter())
 subplot(224)
 plot(-x*1e5,-x*1e-4)
+gca().xaxis.set_major_formatter(OldScalarFormatter())
+gca().yaxis.set_major_formatter(OldScalarFormatter())
 
 x=frange(0,1,.01)
 f=figure(figsize=(6,6))
/trunk/matplotlib/lib/matplotlib/ticker.py Diff Switch to side-by-side view
--- a/trunk/matplotlib/lib/matplotlib/ticker.py
+++ b/trunk/matplotlib/lib/matplotlib/ticker.py
@@ -277,10 +277,13 @@
             offsetStr = ''
             sciNotStr = ''
             if self.offset:
-                offsetStr = self.format_data(self.offset, sign=True, mathtext=True)
+                if self._usetex or self._useMathText:
+                    offsetStr = self.format_data(self.offset, sign=True, mathtext=True)
+                else:
+                    offsetStr = self.format_data(self.offset, sign=True, mathtext=False)
             if self.orderOfMagnitude:
                 if self._usetex or self._useMathText:
-                    sciNotStr = r'\times'+self.format_data(10**self.orderOfMagnitude, mathtext=True)
+                    sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude, mathtext=True)
                 else:
                     sciNotStr = 'x1e%+d'% self.orderOfMagnitude
             if self._useMathText or self._usetex: return ''.join(('$',sciNotStr,offsetStr,'$'))
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.