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

Skip to content

Commit 97bd353

Browse files
committed
Merged revisions 3885-3895 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r3894 | mdboom | 2007-09-26 09:41:15 -0400 (Wed, 26 Sep 2007) | 3 lines Bugfix: Display exponents in tick values in the default font (not the default math font) ........ svn path=/branches/transforms/; revision=3896
1 parent 426eabc commit 97bd353

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

lib/matplotlib/mathtext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ def __init__(self):
18551855
"tanh")
18561856

18571857
fontname = oneOf("rm cal it tt sf bf")
1858-
latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf")
1858+
latex2efont = oneOf("mathrm mathcal mathit mathtt mathsf mathbf mathdefault")
18591859

18601860
space =(FollowedBy(bslash)
18611861
+ (Literal(r'\ ')

lib/matplotlib/ticker.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,12 @@ def get_offset(self):
300300
sciNotStr = r'{\times}'+self.format_data(10**self.orderOfMagnitude)
301301
else:
302302
sciNotStr = u'\xd7'+'1e%d'% self.orderOfMagnitude
303-
if self._useMathText or self._usetex:
303+
if self._useMathText:
304+
return ''.join(('$\mathdefault{',sciNotStr,offsetStr,'}$'))
305+
elif self._usetex:
304306
return ''.join(('$',sciNotStr,offsetStr,'$'))
305-
else: return ''.join((sciNotStr,offsetStr))
307+
else:
308+
return ''.join((sciNotStr,offsetStr))
306309
else: return ''
307310

308311
def set_locs(self, locs):
@@ -363,8 +366,11 @@ def _set_format(self):
363366
for loc in locs]
364367
sigfigs.sort()
365368
self.format = '%1.' + str(sigfigs[-1]) + 'f'
366-
if self._usetex or self._useMathText: self.format = '$%s$'%self.format
367-
369+
if self._usetex:
370+
self.format = '$%s$' % self.format
371+
elif self._useMathText:
372+
self.format = '$\mathdefault{%s}$' % self.format
373+
368374
def pprint_val(self, x):
369375
xp = (x-self.offset)/10**self.orderOfMagnitude
370376
if npy.absolute(xp) < 1e-8: xp = 0
@@ -511,11 +517,13 @@ def __call__(self, x, pos=None):
511517
elif not isDecade:
512518
if usetex:
513519
s = r'$%d^{%.2f}$'% (b, fx)
514-
else: s = '$%d^{%.2f}$'% (b, fx)
520+
else:
521+
s = '$\mathdefault{%d^{%.2f}}$'% (b, fx)
515522
else:
516523
if usetex:
517524
s = r'$%d^{%d}$'% (b, self.nearest_long(fx))
518-
else: s = r'$%d^{%d}$'% (b, self.nearest_long(fx))
525+
else:
526+
s = r'$\mathdefault{%d^{%d}}$'% (b, self.nearest_long(fx))
519527

520528
return s
521529

0 commit comments

Comments
 (0)