@@ -280,7 +280,7 @@ def format_data_short(self, value):
280
280
"""
281
281
Return a short string version of the tick value.
282
282
283
- Defaults to the position-indepedent long value.
283
+ Defaults to the position-independent long value.
284
284
"""
285
285
return self .format_data (value )
286
286
@@ -398,7 +398,7 @@ class FormatStrFormatter(Formatter):
398
398
Use an old-style ('%' operator) format string to format the tick.
399
399
400
400
The format string should have a single variable format (%) in it.
401
- It will be applied to the value (not the postition ) of the tick.
401
+ It will be applied to the value (not the position ) of the tick.
402
402
"""
403
403
def __init__ (self , fmt ):
404
404
self .fmt = fmt
@@ -487,19 +487,16 @@ def pprint_val(self, x, d):
487
487
class ScalarFormatter (Formatter ):
488
488
"""
489
489
Format tick values as a number.
490
+
491
+ Tick value is interpreted as a plain old number. If
492
+ ``useOffset==True`` and the data range is much smaller than the data
493
+ average, then an offset will be determined such that the tick labels
494
+ are meaningful. Scientific notation is used for ``data < 10^-n`` or
495
+ ``data >= 10^m``, where ``n`` and ``m`` are the power limits set
496
+ using ``set_powerlimits((n,m))``. The defaults for these are
497
+ controlled by the ``axes.formatter.limits`` rc parameter.
490
498
"""
491
499
def __init__ (self , useOffset = None , useMathText = None , useLocale = None ):
492
- """
493
- Tick value is interpreted as a plain old number. If
494
- ``useOffset==True`` and the data range is much smaller than the
495
- data average, then an offset will be determined such that the
496
- tick labels are meaningful. Scientific notation is used for
497
- ``data < 10^-n`` or ``data >= 10^m``, where ``n`` and ``m`` are
498
- the power limits set using ``set_powerlimits((n,m))``. The
499
- defaults for these are controlled by the
500
- ``axes.formatter.limits`` rc parameter.
501
- """
502
-
503
500
# useOffset allows plotting small data ranges with large offsets: for
504
501
# example: [1+1e-9,1+2e-9,1+3e-9] useMathText will render the offset
505
502
# and scientific notation in mathtext
@@ -553,7 +550,9 @@ def fix_minus(self, s):
553
550
return s .replace ('-' , '\u2212 ' )
554
551
555
552
def __call__ (self , x , pos = None ):
556
- 'Return the format for tick val *x* at position *pos*'
553
+ """
554
+ Return the format for tick value `x` at position `pos`.
555
+ """
557
556
if len (self .locs ) == 0 :
558
557
return ''
559
558
else :
@@ -572,7 +571,7 @@ def set_powerlimits(self, lims):
572
571
"""
573
572
Sets size thresholds for scientific notation.
574
573
575
- Limits is a two-element sequence containing the powers of 10
574
+ ``lims`` is a two-element sequence containing the powers of 10
576
575
that determine the switchover threshold. Numbers below
577
576
``10**lims[0]`` and above ``10**lims[1]`` will be displayed in
578
577
scientific notation.
@@ -995,8 +994,15 @@ class EngFormatter(Formatter):
995
994
"""
996
995
Formats axis values using engineering prefixes to represent powers
997
996
of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
998
- """
999
997
998
+ `unit` is a string containing the abbreviated name of the unit,
999
+ suitable for use with single-letter representations of powers of
1000
+ 1000. For example, 'Hz' or 'm'.
1001
+
1002
+ `places` is the percision with which to display the number,
1003
+ specified in digits after the decimal point (there will be between
1004
+ one and three digits before the decimal point).
1005
+ """
1000
1006
# The SI engineering prefixes
1001
1007
ENG_PREFIXES = {
1002
1008
- 24 : "y" ,
@@ -1019,17 +1025,6 @@ class EngFormatter(Formatter):
1019
1025
}
1020
1026
1021
1027
def __init__ (self , unit = "" , places = None ):
1022
- """
1023
- Initializes an engineering notation formatter.
1024
-
1025
- `unit` is a string containing the abbreviated name of the unit,
1026
- suitable for use with single-letter representations of powers of
1027
- 1000. For example, 'Hz' or 'm'.
1028
-
1029
- `places` is the percision with which to display the number,
1030
- specified in digits after the decimal point (there will be
1031
- between one and three digits before the decimal point).
1032
- """
1033
1028
self .unit = unit
1034
1029
self .places = places
1035
1030
0 commit comments