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

Class BboxTransformFrom

lib/matplotlib/transforms.py:2665–2697  ·  view source on GitHub ↗

`BboxTransformFrom` linearly transforms points from a given `Bbox` to the unit bounding box.

Source from the content-addressed store, hash-verified

2663
2664
2665class BboxTransformFrom(Affine2DBase):
2666 """
2667 `BboxTransformFrom` linearly transforms points from a given `Bbox` to the
2668 unit bounding box.
2669 """
2670 is_separable = True
2671
2672 def __init__(self, boxin, **kwargs):
2673 _api.check_isinstance(BboxBase, boxin=boxin)
2674
2675 super().__init__(**kwargs)
2676 self._boxin = boxin
2677 self.set_children(boxin)
2678 self._mtx = None
2679 self._inverted = None
2680
2681 __str__ = _make_str_method("_boxin")
2682
2683 def get_matrix(self):
2684 # docstring inherited
2685 if self._invalid:
2686 inl, inb, inw, inh = self._boxin.bounds
2687 if DEBUG and (inw == 0 or inh == 0):
2688 raise ValueError("Transforming from a singular bounding box.")
2689 x_scale = 1.0 / inw
2690 y_scale = 1.0 / inh
2691 self._mtx = np.array([[x_scale, 0.0, -inl*x_scale],
2692 [ 0.0, y_scale, -inb*y_scale],
2693 [ 0.0, 0.0, 1.0]],
2694 float)
2695 self._inverted = None
2696 self._invalid = 0
2697 return self._mtx
2698
2699
2700class ScaledTranslation(Affine2DBase):

Callers 1

_update_locMethod · 0.90

Calls 1

_make_str_methodFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…