Revision: 3894
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3894&view=rev
Author:   mdboom
Date:     2007-09-26 06:41:15 -0700 (Wed, 26 Sep 2007)

Log Message:
-----------
Bugfix: Display exponents in tick values in the default font (not the
default math font)

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/mathtext.py
    trunk/matplotlib/lib/matplotlib/ticker.py

Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-09-26 12:29:05 UTC (rev 
3893)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-09-26 13:41:15 UTC (rev 
3894)
@@ -1855,7 +1855,7 @@
                              "tanh")
 
         fontname     = oneOf("rm cal it tt sf bf")
-        latex2efont  = oneOf("mathrm mathcal mathit mathtt mathsf mathbf")
+        latex2efont  = oneOf("mathrm mathcal mathit mathtt mathsf mathbf 
mathdefault")
 
         space        =(FollowedBy(bslash)
                      +   (Literal(r'\ ')

Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py   2007-09-26 12:29:05 UTC (rev 
3893)
+++ trunk/matplotlib/lib/matplotlib/ticker.py   2007-09-26 13:41:15 UTC (rev 
3894)
@@ -332,9 +332,12 @@
                     sciNotStr = 
r'{\times}'+self.format_data(10**self.orderOfMagnitude)
                 else:
                     sciNotStr = u'\xd7'+'1e%d'% self.orderOfMagnitude
-            if self._useMathText or self._usetex:
+            if self._useMathText:
+                return ''.join(('$\mathdefault{',sciNotStr,offsetStr,'}$'))
+            elif self._usetex:
                 return ''.join(('$',sciNotStr,offsetStr,'$'))
-            else: return ''.join((sciNotStr,offsetStr))
+            else:
+                return ''.join((sciNotStr,offsetStr))
         else: return ''
 
     def set_locs(self, locs):
@@ -395,8 +398,11 @@
                    for loc in locs]
         sigfigs.sort()
         self.format = '%1.' + str(sigfigs[-1]) + 'f'
-        if self._usetex or self._useMathText: self.format = '$%s$'%self.format
-
+        if self._usetex:
+            self.format = '$%s$' % self.format
+        elif self._useMathText:
+            self.format = '$\mathdefault{%s}$' % self.format
+            
     def pprint_val(self, x):
         xp = (x-self.offset)/10**self.orderOfMagnitude
         if npy.absolute(xp) < 1e-8: xp = 0
@@ -545,11 +551,13 @@
         elif not isDecade:
             if usetex:
                 s = r'$%d^{%.2f}$'% (b, fx)
-            else: s = '$%d^{%.2f}$'% (b, fx)
+            else:
+                s = '$\mathdefault{%d^{%.2f}}$'% (b, fx)
         else:
             if usetex:
                 s = r'$%d^{%d}$'% (b, self.nearest_long(fx))
-            else: s = r'$%d^{%d}$'% (b, self.nearest_long(fx))
+            else:
+                s = r'$\mathdefault{%d^{%d}}$'% (b, self.nearest_long(fx))
 
         return s
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to