Set the bbox that the box is anchored to. *bbox* can be a Bbox instance, a list of [left, bottom, width, height], or a list of [left, bottom] where the width and height will be assumed to be zero. The bbox will be transformed to display coordinate by the giv
(self, bbox, transform=None)
| 1033 | return TransformedBbox(self._bbox_to_anchor, transform) |
| 1034 | |
| 1035 | def set_bbox_to_anchor(self, bbox, transform=None): |
| 1036 | """ |
| 1037 | Set the bbox that the box is anchored to. |
| 1038 | |
| 1039 | *bbox* can be a Bbox instance, a list of [left, bottom, width, |
| 1040 | height], or a list of [left, bottom] where the width and |
| 1041 | height will be assumed to be zero. The bbox will be |
| 1042 | transformed to display coordinate by the given transform. |
| 1043 | """ |
| 1044 | if bbox is None or isinstance(bbox, BboxBase): |
| 1045 | self._bbox_to_anchor = bbox |
| 1046 | else: |
| 1047 | try: |
| 1048 | l = len(bbox) |
| 1049 | except TypeError as err: |
| 1050 | raise ValueError(f"Invalid bbox: {bbox}") from err |
| 1051 | |
| 1052 | if l == 2: |
| 1053 | bbox = [bbox[0], bbox[1], 0, 0] |
| 1054 | |
| 1055 | self._bbox_to_anchor = Bbox.from_bounds(*bbox) |
| 1056 | |
| 1057 | self._bbox_to_anchor_transform = transform |
| 1058 | self.stale = True |
| 1059 | |
| 1060 | @_compat_get_offset |
| 1061 | def get_offset(self, bbox, renderer): |