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

Skip to content

Commit a31be02

Browse files
committed
Added missing constructor default values. Added missing __str__ methods.
1 parent 3bb328f commit a31be02

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

lib/matplotlib/scale.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class LogTransformBase(Transform):
9393
is_separable = True
9494
has_inverse = True
9595

96-
def __init__(self, nonpos):
96+
def __init__(self, nonpos='mask'):
9797
Transform.__init__(self)
9898
self._clip = {"clip": True, "mask": False}[nonpos]
9999

@@ -114,6 +114,8 @@ def transform_non_affine(self, a):
114114
out[a <= 0] = -1000
115115
return out
116116

117+
def __str__(self):
118+
return "{}({!r})".format(type(self).__name__, "clip" if self._clip else "mask")
117119

118120
class InvertedLogTransformBase(Transform):
119121
input_dims = 1
@@ -124,6 +126,9 @@ class InvertedLogTransformBase(Transform):
124126
def transform_non_affine(self, a):
125127
return ma.power(self.base, a)
126128

129+
def __str__(self):
130+
return "{}()".format(type(self).__name__)
131+
127132

128133
class Log10Transform(LogTransformBase):
129134
base = 10.0
@@ -168,7 +173,7 @@ def inverted(self):
168173

169174

170175
class LogTransform(LogTransformBase):
171-
def __init__(self, base, nonpos):
176+
def __init__(self, base, nonpos='mask'):
172177
LogTransformBase.__init__(self, nonpos)
173178
self.base = base
174179

@@ -448,7 +453,7 @@ class LogitTransform(Transform):
448453
is_separable = True
449454
has_inverse = True
450455

451-
def __init__(self, nonpos):
456+
def __init__(self, nonpos='mask'):
452457
Transform.__init__(self)
453458
self._nonpos = nonpos
454459
self._clip = {"clip": True, "mask": False}[nonpos]
@@ -465,6 +470,9 @@ def transform_non_affine(self, a):
465470
def inverted(self):
466471
return LogisticTransform(self._nonpos)
467472

473+
def __str__(self):
474+
return "{}({!r})".format(type(self).__name__, "clip" if self._clip else "mask")
475+
468476

469477
class LogisticTransform(Transform):
470478
input_dims = 1
@@ -483,6 +491,9 @@ def transform_non_affine(self, a):
483491
def inverted(self):
484492
return LogitTransform(self._nonpos)
485493

494+
def __str__(self):
495+
return "{}({!r})".format(type(self).__name__, self._nonpos)
496+
486497

487498
class LogitScale(ScaleBase):
488499
"""

0 commit comments

Comments
 (0)