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

Skip to content

Commit 29b2ea6

Browse files
committed
Responses to PR#6253
1 parent c94d0b1 commit 29b2ea6

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
@@ -282,7 +282,7 @@ def format_data_short(self, value):
282282
"""
283283
Return a short string version of the tick value.
284284
285-
Defaults to the position-indepedent long value.
285+
Defaults to the position-independent long value.
286286
"""
287287
return self.format_data(value)
288288

@@ -400,7 +400,7 @@ class FormatStrFormatter(Formatter):
400400
Use an old-style ('%' operator) format string to format the tick.
401401
402402
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.
404404
"""
405405
def __init__(self, fmt):
406406
self.fmt = fmt
@@ -489,19 +489,16 @@ def pprint_val(self, x, d):
489489
class ScalarFormatter(Formatter):
490490
"""
491491
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.
492500
"""
493501
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-
505502
# useOffset allows plotting small data ranges with large offsets: for
506503
# example: [1+1e-9,1+2e-9,1+3e-9] useMathText will render the offset
507504
# and scientific notation in mathtext
@@ -555,7 +552,9 @@ def fix_minus(self, s):
555552
return s.replace('-', '\u2212')
556553

557554
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+
"""
559558
if len(self.locs) == 0:
560559
return ''
561560
else:
@@ -574,7 +573,7 @@ def set_powerlimits(self, lims):
574573
"""
575574
Sets size thresholds for scientific notation.
576575
577-
Limits is a two-element sequence containing the powers of 10
576+
``lims`` is a two-element sequence containing the powers of 10
578577
that determine the switchover threshold. Numbers below
579578
``10**lims[0]`` and above ``10**lims[1]`` will be displayed in
580579
scientific notation.
@@ -997,8 +996,15 @@ class EngFormatter(Formatter):
997996
"""
998997
Formats axis values using engineering prefixes to represent powers
999998
of 1000, plus a specified unit, e.g., 10 MHz instead of 1e7.
1000-
"""
1001999
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+
"""
10021008
# The SI engineering prefixes
10031009
ENG_PREFIXES = {
10041010
-24: "y",
@@ -1021,17 +1027,6 @@ class EngFormatter(Formatter):
10211027
}
10221028

10231029
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-
"""
10351030
self.unit = unit
10361031
self.places = places
10371032

0 commit comments

Comments
 (0)