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

Skip to content

Commit e0a8e9e

Browse files
committed
Merge branch 'ticker-mathtext' of https://github.com/ddale/matplotlib into ddale-ticker-mathtext
Conflicts: CHANGELOG
2 parents 5970bde + 93abf33 commit e0a8e9e

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

CHANGELOG

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2012-06-24 Make use of mathtext in tick labels configurable - DSD
2+
13
2012-06-05 Images loaded through PIL are now ordered correctly - CG
24

35
2012-06-02 Add new Axes method and pyplot function, hist2d. - PO
@@ -63,10 +65,8 @@
6365
2011-12-29 ps and pdf markers are now stroked only if the line width
6466
is nonzero for consistency with agg, fixes issue #621. - JKS
6567

66-
6768
2011-12-27 Work around an EINTR bug in some versions of subprocess. - JKS
6869

69-
7070
2011-10-25 added support for \operatorname to mathtext,
7171
including the ability to insert spaces, such as
7272
$\operatorname{arg\,max}$ - PI

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ def __call__(self, s):
466466
# use scientific notation if log10
467467
# of the axis range is smaller than the
468468
# first or larger than the second
469-
'axes.formatter.use_locale' : [False, validate_bool], # Use the current locale to format ticks
469+
'axes.formatter.use_locale' : [False, validate_bool],
470+
# Use the current locale to format ticks
471+
'axes.formatter.use_mathtext' : [False, validate_bool],
470472
'axes.unicode_minus' : [True, validate_bool],
471473
'axes.color_cycle' : [['b','g','r','c','m','y','k'],
472474
validate_colorlist], # cycle of plot

lib/matplotlib/ticker.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,21 +330,22 @@ class ScalarFormatter(Formatter):
330330
331331
"""
332332

333-
def __init__(self, useOffset=True, useMathText=False, useLocale=None):
333+
def __init__(self, useOffset=True, useMathText=None, useLocale=None):
334334
# useOffset allows plotting small data ranges with large offsets:
335335
# for example: [1+1e-9,1+2e-9,1+3e-9]
336336
# useMathText will render the offset and scientific notation in mathtext
337337
self.set_useOffset(useOffset)
338338
self._usetex = rcParams['text.usetex']
339+
if useMathText is None:
340+
useMathText = rcParams['axes.formatter.use_mathtext']
339341
self._useMathText = useMathText
340342
self.orderOfMagnitude = 0
341343
self.format = ''
342344
self._scientific = True
343345
self._powerlimits = rcParams['axes.formatter.limits']
344346
if useLocale is None:
345-
self._useLocale = rcParams['axes.formatter.use_locale']
346-
else:
347-
self._useLocale = useLocale
347+
useLocale = rcParams['axes.formatter.use_locale']
348+
self._useLocale = useLocale
348349

349350
def get_useOffset(self):
350351
return self._useOffset

matplotlibrc.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ text.hinting_factor : 8 # Specifies the amount of softness for hinting in the
231231
# according to the user's locale.
232232
# For example, use ',' as a decimal
233233
# separator in the fr_FR locale.
234+
#axes.formatter.use_mathtext : False # When True, use mathtext for scientific
235+
# notation.
234236
#axes.unicode_minus : True # use unicode for the minus symbol
235237
# rather than hyphen. See
236238
# http://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes

0 commit comments

Comments
 (0)