8000 ScalarFormatter renders scientific notation and large numerical offse… · matplotlib/matplotlib@039af43 · GitHub
[go: up one dir, main page]

Skip to content

Commit 039af43

Browse files
committed
ScalarFormatter renders scientific notation and large numerical offsets in
a label at the end of the axis by default. The old formatter is masked as _ScalarFormatter, in case someone wants the old behavior. -DSD svn path=/trunk/matplotlib/; revision=1394
1 parent 0801df8 commit 039af43

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
New entries should be added at the top
22

3+
2005-06-01 The default behavior of ScalarFormatter now renders scientific
4+
notation and large numerical offsets in a label at the end of
5+
the axis. - DSD
6+
37
2005-06-01 Added Nicholas' frombyte image patch - JDH
48

59
2005-05-31 Added vertical TeX support for agg - JDH

lib/matplotlib/ticker.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
from __future__ import division
111111
import sys, os, re, time, math, warnings
112112
from mlab import linspace
113-
from matplotlib import verbose
113+
from matplotlib import verbose, rcParams
114114
from numerix import absolute, arange, array, asarray, Float, floor, log, \
115115
logical_and, nonzero, ones, take, zeros
116116
from matplotlib.numerix.mlab import amin, amax, std, mean
@@ -199,9 +199,9 @@ def __init__(self, fmt):
199199
def __call__(self, x, pos=0):
200200
'Return the format for tick val x at position pos'
201201
return self.fmt % x
202-
203-
204-
class ScalarFormatter(Formatter):
202+
203+
204+
class _ScalarFormatter(Formatter):
205205
"""
206206
Tick location is a plain old number. If viewInterval is set, the
207207
formatter will use %d, %1.#f or %1.ef as appropriate. If it is
@@ -239,7 +239,7 @@ def pprint_val(self, x, d):
239239
return s
240240

241241

242-
class NewScalarFormatter(Formatter):
242+
class ScalarFormatter(Formatter):
243243
"""
244244
Tick location is a plain old number. If useOffset==True and the data range
245245
is much smaller than the data average, then an offset will be determined
@@ -253,7 +253,7 @@ def __init__(self, useOffset=True, useMathText=False):
253253
# for example: [1+1e-9,1+2e-9,1+3e-9]
254254
# useMathText will render the offset an scientific notation in mathtext
255255
self._useOffset = useOffset
256-
self._useMathText = useMathText
256+
self._useMathText = useMathText or rcParams['text.usetex']
257257
self.offset = 0
258258
self.orderOfMagnitude = 0
259259
self.format = ''

0 commit comments

Comments
 (0)
0