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

Skip to content

Commit 3318d77

Browse files
committed
MAINT: Responses to PR#6251
1 parent 0fc055a commit 3318d77

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/matplotlib/ticker.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
:class:`EngFormatter`
135135
Format labels in engineering notation
136136
137-
:class:`PerentFormatter`
137+
:class:`PercentFormatter`
138138
Format labels as a percentage
139139
140140
You can derive your own formatter from the Formatter base class by
@@ -1016,7 +1016,7 @@ def __init__(self, unit="", places=None):
10161016
suitable for use with single-letter representations of powers of
10171017
1000. For example, 'Hz' or 'm'.
10181018
1019-
`places` is the percision with which to display the number,
1019+
`places` is the prrcision with which to display the number,
10201020
specified in digits after the decimal point (there will be
10211021
between one and three digits before the decimal point).
10221022
"""
@@ -1083,12 +1083,12 @@ class PercentFormatter(Formatter):
10831083
Format numbers as a percentage.
10841084
10851085
How the number is converted into a percentage is determined by the
1086-
`mx` parameter. `mx` is the data value that corresponds to 100%.
1087-
Percentages are computed as ``x / mx * 100``. So if the data is
1088-
already scaled to be percentages, `mx` will be 100. Another common
1086+
`max` parameter. `max` is the data value that corresponds to 100%.
1087+
Percentages are computed as ``x / max * 100``. So if the data is
1088+
already scaled to be percentages, `max` will be 100. Another common
10891089
situation is where `max` is 1.0.
10901090
"""
1091-
def __init__(self, mx=100, decimals=None, symbol='%'):
1091+
def __init__(self, max=100, decimals=None, symbol='%'):
10921092
"""
10931093
Initializes the formatter.
10941094
@@ -1097,7 +1097,7 @@ def __init__(self, mx=100, decimals=None, symbol='%'):
10971097
or empty to indicate that no symbol should be used. `decimals`
10981098
is the number of decimal places to place after the
10991099
"""
1100-
self.max = mx + 0.0
1100+
self.max = max + 0.0
11011101
self.decimals = decimals
11021102
self.symbol = symbol
11031103

@@ -1156,7 +1156,7 @@ def format_pct(self, x, d):
11561156
return s
11571157

11581158
def convert_to_pct(self, x):
1159-
return x / self.max * 100.0
1159+
return 100.0 * (x / self.max)
11601160

11611161

11621162
class Locator(TickHelper):

0 commit comments

Comments
 (0)