Return the offset transform. Parameters ---------- renderer : `RendererBase` The renderer to use to compute the offset Returns ------- `Transform` Maps (x, y) in pixel or point units to screen units relati
(self, renderer)
| 1644 | return self._unit |
| 1645 | |
| 1646 | def __call__(self, renderer): |
| 1647 | """ |
| 1648 | Return the offset transform. |
| 1649 | |
| 1650 | Parameters |
| 1651 | ---------- |
| 1652 | renderer : `RendererBase` |
| 1653 | The renderer to use to compute the offset |
| 1654 | |
| 1655 | Returns |
| 1656 | ------- |
| 1657 | `Transform` |
| 1658 | Maps (x, y) in pixel or point units to screen units |
| 1659 | relative to the given artist. |
| 1660 | """ |
| 1661 | if isinstance(self._artist, Artist): |
| 1662 | bbox = self._artist.get_window_extent(renderer) |
| 1663 | xf, yf = self._ref_coord |
| 1664 | x = bbox.x0 + bbox.width * xf |
| 1665 | y = bbox.y0 + bbox.height * yf |
| 1666 | elif isinstance(self._artist, BboxBase): |
| 1667 | bbox = self._artist |
| 1668 | xf, yf = self._ref_coord |
| 1669 | x = bbox.x0 + bbox.width * xf |
| 1670 | y = bbox.y0 + bbox.height * yf |
| 1671 | elif isinstance(self._artist, Transform): |
| 1672 | x, y = self._artist.transform(self._ref_coord) |
| 1673 | else: |
| 1674 | _api.check_isinstance((Artist, BboxBase, Transform), artist=self._artist) |
| 1675 | scale = 1 if self._unit == "pixels" else renderer.points_to_pixels(1) |
| 1676 | return Affine2D().scale(scale).translate(x, y) |
| 1677 | |
| 1678 | |
| 1679 | class _AnnotationBase: |
nothing calls this directly
no test coverage detected