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