MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / InvertedSymmetricalLogTransform

Class InvertedSymmetricalLogTransform

lib/matplotlib/scale.py:527–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525
526
527class InvertedSymmetricalLogTransform(Transform):
528 input_dims = output_dims = 1
529
530 def __init__(self, base, linthresh, linscale):
531 super().__init__()
532 if base <= 1.0:
533 raise ValueError("'base' must be larger than 1")
534 if linthresh <= 0.0:
535 raise ValueError("'linthresh' must be positive")
536 if linscale <= 0.0:
537 raise ValueError("'linscale' must be positive")
538 self.base = base
539 self.linthresh = linthresh
540 self.linscale = linscale
541
542 @_api.deprecated("3.11", name="invlinthresh", obj_type="attribute",
543 alternative=".inverted().transform(linthresh)")
544 @property
545 def invlinthresh(self):
546 invlinthresh = self.inverted().transform(self.linthresh)
547 return invlinthresh
548
549 def transform_non_affine(self, values):
550 linscale_adj = self.linscale / (1.0 - 1.0 / self.base)
551 invlinthresh = self.inverted().transform(self.linthresh)
552
553 abs_a = np.abs(values)
554 inside = abs_a <= invlinthresh
555 if np.all(inside): # Fast path: all values in linear region
556 return values / linscale_adj
557 with np.errstate(divide="ignore", invalid="ignore"):
558 out = np.sign(values) * self.linthresh * np.exp(
559 (abs_a / self.linthresh - linscale_adj) * np.log(self.base))
560 out[inside] = values[inside] / linscale_adj
561 return out
562
563 def inverted(self):
564 return SymmetricalLogTransform(self.base,
565 self.linthresh, self.linscale)
566
567
568class SymmetricalLogScale(ScaleBase):

Callers 1

invertedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…