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

Skip to content

Commit 7602b04

Browse files
committed
Responses to PR#6253
1 parent 1f3b2f9 commit 7602b04

File tree

1 file changed

+22
-27
lines changed

1 file changed

+22
-27
lines changed

lib/matplotlib/ticker.py

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def format_data_short(self, value):
280280
"""
281281
Return a short string version of the tick value.
282282
283-
Defaults to the position-indepedent long value.
283+
Defaults to the position-independent long value.
284284
"""
285285
return self.format_data(value)
286286

@@ -398,7 +398,7 @@ class FormatStrFormatter(Formatter):
398398
Use an old-style ('%' operator) format string to format the tick.
399399
400400
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.
402402
"""
403403
def __init__(self, fmt):
404404
self.fmt = fmt
@@ -487,19 +487,16 @@ def pprint_val(self, x, d):
487487
class ScalarFormatter(Formatter):
488488
"""
489489
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.
490498
"""
491499
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-
503500
# useOffset allows plotting small data ranges with large offsets: for
504501
# example: [1+1e-9,1+2e-9,1+3e-9] useMathText will render the offset
505502
# and scientific notation in mathtext
@@ -553,7 +550,9 @@ def fix_minus(self, s):
553550
return s.replace('-', '\u2212')
554551

555552
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+
"""
557556
if len(self.locs) == 0:
558557
return ''
559558
else:
@@ -572,7 +571,7 @@ def set_powerlimits(self, lims):
572571
"""
573572
Sets size thresholds for scientific notation.
574573
575-
Limits is a two-element sequence containing the powers of 10
574+
``lims`` is a two-element sequence containing the powers of 10
576575
that determine the switchover threshold. Numbers below
577576
``10**lims[0]`` and above ``10**lims[1]`` will be displayed in
578577
scientific notation.
@@ -995,8 +994,15 @@ class EngFormatter(Formatter):
995994
"""
996995
Formats axis values using engineering prefixes to represent powers
997996
of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
998-
"""
999997
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+
"""
10001006
# The SI engineering prefixes
10011007
ENG_PREFIXES = {
10021008
-24: "y",
@@ -1019,17 +1025,6 @@ class EngFormatter(Formatter):
10191025
}
10201026

10211027
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-
"""
10331028
self.unit = unit
10341029
self.places = places
10351030

0 commit comments

Comments
 (0)