134
134
:class:`EngFormatter`
135
135
Format labels in engineering notation
136
136
137
- :class:`PerentFormatter `
137
+ :class:`PercentFormatter `
138
138
Format labels as a percentage
139
139
140
140
You can derive your own formatter from the Formatter base class by
@@ -1016,7 +1016,7 @@ def __init__(self, unit="", places=None):
1016
1016
suitable for use with single-letter representations of powers of
1017
1017
1000. For example, 'Hz' or 'm'.
1018
1018
1019
- `places` is the percision with which to display the number,
1019
+ `places` is the prrcision with which to display the number,
1020
1020
specified in digits after the decimal point (there will be
1021
1021
between one and three digits before the decimal point).
1022
1022
"""
@@ -1083,12 +1083,12 @@ class PercentFormatter(Formatter):
1083
1083
Format numbers as a percentage.
1084
1084
1085
1085
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
1089
1089
situation is where `max` is 1.0.
1090
1090
"""
1091
- def __init__ (self , mx = 100 , decimals = None , symbol = '%' ):
1091
+ def __init__ (self , max = 100 , decimals = None , symbol = '%' ):
1092
1092
"""
1093
1093
Initializes the formatter.
1094
1094
@@ -1097,7 +1097,7 @@ def __init__(self, mx=100, decimals=None, symbol='%'):
1097
1097
or empty to indicate that no symbol should be used. `decimals`
1098
1098
is the number of decimal places to place after the
1099
1099
"""
1100
- self .max = mx + 0.0
1100
+ self .max = max + 0.0
1101
1101
self .decimals = decimals
1102
1102
self .symbol = symbol
1103
1103
@@ -1156,7 +1156,7 @@ def format_pct(self, x, d):
1156
1156
return s
1157
1157
1158
1158
def convert_to_pct (self , x ):
1159
- return x / self .max * 100.0
1159
+ return 100.0 * ( x / self .max )
1160
1160
1161
1161
1162
1162
class Locator (TickHelper ):
0 commit comments