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

Class FuncTransform

lib/matplotlib/scale.py:233–266  ·  view source on GitHub ↗

A simple transform that takes and arbitrary function for the forward and inverse transform.

Source from the content-addressed store, hash-verified

231
232
233class FuncTransform(Transform):
234 """
235 A simple transform that takes and arbitrary function for the
236 forward and inverse transform.
237 """
238
239 input_dims = output_dims = 1
240
241 def __init__(self, forward, inverse):
242 """
243 Parameters
244 ----------
245 forward : callable
246 The forward function for the transform. This function must have
247 an inverse and, for best behavior, be monotonic.
248 It must have the signature::
249
250 def forward(values: array-like) -> array-like
251
252 inverse : callable
253 The inverse of the forward function. Signature as ``forward``.
254 """
255 super().__init__()
256 if callable(forward) and callable(inverse):
257 self._forward = forward
258 self._inverse = inverse
259 else:
260 raise ValueError('arguments to FuncTransform must be functions')
261
262 def transform_non_affine(self, values):
263 return self._forward(values)
264
265 def inverted(self):
266 return FuncTransform(self._inverse, self._forward)
267
268
269class FuncScale(ScaleBase):

Callers 3

invertedMethod · 0.85
__init__Method · 0.85
__init__Method · 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…