Skip to content

Commit 92721ed

Browse files
committed
Merge pull request #1146 from mcelrath/symlog
Fix invalid transformation in InvertedSymmetricalLogTransform.
2 parents d8dda52 + 006dc7a commit 92721ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/scale.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,19 @@ class InvertedSymmetricalLogTransform(Transform):
347347

348348
def __init__(self, base, linthresh, linscale):
349349
Transform.__init__(self)
350+
symlog = SymmetricalLogScale.SymmetricalLogTransform(base, linthresh, linscale)
350351
self.base = base
351352
self.linthresh = linthresh
353+
self.invlinthresh = symlog.transform(linthresh)
352354
self.linscale = linscale
353355
self._linscale_adj = (linscale / (1.0 - self.base ** -1))
354356

355357
def transform(self, a):
356358
sign = np.sign(a)
357-
masked = ma.masked_inside(a, -self.linthresh, self.linthresh, copy=False)
359+
masked = ma.masked_inside(a, -self.invlinthresh, self.invlinthresh, copy=False)
358360
exp = sign * self.linthresh * (
359-
ma.power(self.base, sign * (masked / self.linthresh))
360-
- self._linscale_adj)
361+
ma.power(self.base, (sign * (masked / self.linthresh))
362+
- self._linscale_adj))
361363
if masked.mask.any():
362364
return ma.where(masked.mask, a / self._linscale_adj, exp)
363365
else:

0 commit comments

Comments
 (0)