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

Skip to content

Commit ffe1b9d

Browse files
alvarosgalvarosg
alvarosg
authored andcommitted
Class attributes are now hidden
1 parent f818aff commit ffe1b9d

File tree

1 file changed

+32
-90
lines changed

1 file changed

+32
-90
lines changed

lib/matplotlib/colors.py

Lines changed: 32 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -997,11 +997,11 @@ def __init__(self, fpos=(lambda x: x**.5),
997997
if vmin is not None and vmax is not None:
998998
if vmin > vmax:
999999
raise ValueError("vmin must be less than vmax")
1000-
self.fneg = fneg
1001-
self.fpos = fpos
1002-
self.fneginv = fneginv
1003-
self.fposinv = fposinv
1004-
self.center = center
1000+
self._fneg = fneg
1001+
self._fpos = fpos
1002+
self._fneginv = fneginv
1003+
self._fposinv = fposinv
1004+
self._center = center
10051005
Normalize.__init__(self, vmin, vmax, clip)
10061006

10071007
def __call__(self, value, clip=None):
@@ -1013,8 +1013,8 @@ def __call__(self, value, clip=None):
10131013
vmin = self.vmin
10141014
vmax = self.vmax
10151015

1016-
widthpos = 1 - self.center
1017-
widthneg = self.center
1016+
widthpos = 1 - self._center
1017+
widthneg = self._center
10181018

10191019
result[result > vmax] = vmax
10201020
result[result < vmin] = vmin
@@ -1023,17 +1023,17 @@ def __call__(self, value, clip=None):
10231023
masknegative = result < 0
10241024
if vmax > 0 and vmin < 0:
10251025
result[masknegative] = - \
1026-
self.fneg(result[masknegative] / vmin) * widthneg
1027-
result[maskpositive] = self.fpos(
1026+
self._fneg(result[masknegative] / vmin) * widthneg
1027+
result[maskpositive] = self._fpos(
10281028
result[maskpositive] / vmax) * widthpos
10291029

10301030
elif vmax > 0 and vmin >= 0:
1031-
result[maskpositive] = self.fpos(
1031+
result[maskpositive] = self._fpos(
10321032
(result[maskpositive] - vmin) / (vmax - vmin)) * widthpos
10331033

10341034
elif vmax <= 0 and vmin < 0:
10351035
result[masknegative] = - \
1036-
self.fneg((result[maskpositive] - vmax) /
1036+
self._fneg((result[maskpositive] - vmax) /
10371037
(vmin - vmax)) * widthneg
10381038

10391039
result = result + widthneg
@@ -1045,8 +1045,8 @@ def inverse(self, value):
10451045

10461046
vmin = self.vmin
10471047
vmax = self.vmax
1048-
widthpos = 1 - self.center
1049-
widthneg = self.center
1048+
widthpos = 1 - self._center
1049+
widthneg = self._center
10501050

10511051
value = value - widthneg
10521052

@@ -1057,35 +1057,35 @@ def inverse(self, value):
10571057

10581058
if vmax > 0 and vmin < 0:
10591059
value[masknegative] = \
1060-
self.fneginv(-value[masknegative] / widthneg) * vmin
1061-
value[maskpositive] = self.fposinv(
1060+
self._fneginv(-value[masknegative] / widthneg) * vmin
1061+
value[maskpositive] = self._fposinv(
10621062
value[maskpositive] / widthpos) * vmax
10631063

10641064
elif vmax > 0 and vmin >= 0:
1065-
value[maskpositive] = self.fposinv(
1065+
value[maskpositive] = self._fposinv(
10661066
value[maskpositive] / widthpos) * (vmax - vmin) + vmin
1067-
value[masknegative] = -self.fposinv(
1067+
value[masknegative] = -self._fposinv(
10681068
value[masknegative] / widthneg) * (vmax - vmin) + vmin
10691069
elif vmax <= 0 and vmin < 0:
1070-
value[masknegative] = self.fneginv(
1070+
value[masknegative] = self._fneginv(
10711071
-value[masknegative] / widthneg) * (vmin - vmax) + vmax
10721072

10731073
else:
10741074

10751075
if vmax > 0 and vmin < 0:
10761076
if value < 0:
1077-
value = self.fneginv(-value / widthneg) * vmin
1077+
value = self._fneginv(-value / widthneg) * vmin
10781078
else:
1079-
value = self.fposinv(value / widthpos) * vmax
1079+
value = self._fposinv(value / widthpos) * vmax
10801080

10811081
elif vmax > 0 and vmin >= 0:
10821082
if value > 0:
1083-
value = self.fposinv(value / widthpos) * \
1083+
value = self._fposinv(value / widthpos) * \
10841084
(vmax - vmin) + vmin
10851085

10861086
elif vmax <= 0 and vmin < 0:
10871087
if value < 0:
1088-
value = self.fneginv(-value / widthneg) * \
1088+
value = self._fneginv(-value / widthneg) * \
10891089
(vmin - vmax) + vmax
10901090
return value
10911091

@@ -1141,8 +1141,8 @@ def __init__(self, fpos=(lambda x: x**0.5),
11411141
if vmin is not None and vmax is not None:
11421142
if vmin > vmax:
11431143
raise ValueError("vmin must be less than vmax")
1144-
self.fpos = fpos
1145-
self.fposinv = fposinv
1144+
self._fpos = fpos
1145+
self._fposinv = fposinv
11461146
Normalize.__init__(self, vmin, vmax, clip)
11471147

11481148
def __call__(self, value, clip=None):
@@ -1157,7 +1157,7 @@ def __call__(self, value, clip=None):
11571157
result[result > vmax] = vmax
11581158
result[result < vmin] = vmin
11591159

1160-
result = self.fpos((result - vmin) / (vmax - vmin))
1160+
result = self._fpos((result - vmin) / (vmax - vmin))
11611161

11621162
self.autoscale_None(result)
11631163
return result
@@ -1168,9 +1168,9 @@ def inverse(self, value):
11681168
vmax = self.vmax
11691169

11701170
if cbook.iterable(value):
1171-
value = self.fposinv(value) * (vmax - vmin) + vmin
1171+
value = self._fposinv(value) * (vmax - vmin) + vmin
11721172
else:
1173-
value = self.fposinv(value) * (vmax - vmin) + vmin
1173+
value = self._fposinv(value) * (vmax - vmin) + vmin
11741174
return value
11751175

11761176
def ticks(self, N=11):
@@ -1211,8 +1211,8 @@ def __init__(self, fneg=(lambda x: x**0.5), fneginv=(lambda x: x**2),
12111211
if vmin is not None and vmax is not None:
12121212
if vmin > vmax:
12131213
raise ValueError("vmin must be less than vmax")
1214-
self.fneg = fneg
1215-
self.fneginv = fneginv
1214+
self._fneg = fneg
1215+
self._fneginv = fneginv
12161216
Normalize.__init__(self, vmin, vmax, clip)
12171217

12181218
def __call__(self, value, clip=None):
@@ -1227,7 +1227,7 @@ def __call__(self, value, clip=None):
12271227
result[result > vmax] = vmax
12281228
result[result < vmin] = vmin
12291229

1230-
result = -self.fneg((result - vmax) / (vmin - vmax))
1230+
result = -self._fneg((result - vmax) / (vmin - vmax))
12311231
result = result + 1
12321232

12331233
self.autoscale_None(result)
@@ -1241,9 +1241,9 @@ def inverse(self, value):
12411241
value = value - 1
12421242

12431243
if cbook.iterable(value):
1244-
value = self.fneginv(-value) * (vmin - vmax) + vmax
1244+
value = self._fneginv(-value) * (vmin - vmax) + vmax
12451245
else:
1246-
value = self.fneginv(value) * (vmin - vmax) + vmax
1246+
value = self._fneginv(value) * (vmin - vmax) + vmax
12471247

12481248
return value
12491249

@@ -1324,64 +1324,6 @@ def __init__(self, orderneg=2, vmin=None, vmax=None, clip=False):
13241324
vmin=vmin, vmax=vmax, clip=clip)
13251325

13261326

1327-
class SymRootNorm(ArbitraryNorm):
1328-
"""
1329-
Root normalization for positive and negative data.
1330-
"""
1331-
def __init__(self, orderpos=2, orderneg=None,
1332-
vmin=None, vmax=None, clip=False, center=0.5):
1333-
"""
1334-
*orderpos*:
1335-
Degree of the root used to normalize the data for the positive
1336-
direction.
1337-
*orderneg*:
1338-
Degree of the root used to normalize the data for the negative
1339-
direction. By default equal to *orderpos*.
1340-
"""
1341-
1342-
if orderneg is None:
1343-
orderneg = orderpos
1344-
ArbitraryNorm.__init__(self,
1345-
fneg=(lambda x: x**(1. / orderneg)),
1346-
fneginv=(lambda x: x**(orderneg)),
1347-
fpos=(lambda x: x**(1. / orderpos)),
1348-
fposinv=(lambda x: x**(orderpos)),
1349-
center=center,
1350-
vmin=vmin, vmax=vmax, clip=clip)
1351-
1352-
1353-
class PositiveRootNorm(PositiveArbitraryNorm):
1354-
"""
1355-
Root normalization for positive data.
1356-
"""
1357-
def __init__(self, orderpos=2, vmin=None, vmax=None, clip=False):
1358-
"""
1359-
*orderpos*:
1360-
Degree of the root used to normalize the data for the positive
1361-
direction.
1362-
"""
1363-
PositiveArbitraryNorm.__init__(self,
1364-
fpos=(lambda x: x**(1. / orderpos)),
1365-
fposinv=(lambda x: x**(orderpos)),
1366-
vmin=vmin, vmax=vmax, clip=clip)
1367-
1368-
1369-
class NegativeRootNorm(NegativeArbitraryNorm):
1370-
"""
1371-
Root normalization for negative data.
1372-
"""
1373-
def __init__(self, orderneg=2, vmin=None, vmax=None, clip=False):
1374-
"""
1375-
*orderneg*:
1376-
Degree of the root used to normalize the data for the negative
1377-
direction.
1378-
"""
1379-
NegativeArbitraryNorm.__init__(self,
1380-
fneg=(lambda x: x**(1. / orderneg)),
1381-
fneginv=(lambda x: x**(orderneg)),
1382-
vmin=vmin, vmax=vmax, clip=clip)
1383-
1384-
13851327
class LogNorm(Normalize):
13861328
"""
13871329
Normalize a given value to the 0-1 range on a log scale

0 commit comments

Comments
 (0)