Parameters ---------- bounds : [x0, y0, width, height], optional Lower-left corner of rectangle to be marked, and its width and height. If not set, the bounds will be calculated from the data limits of inset_ax, which must be supplied.
(self, bounds=None, inset_ax=None, zorder=None, **kwargs)
| 24 | zorder = 4.99 |
| 25 | |
| 26 | def __init__(self, bounds=None, inset_ax=None, zorder=None, **kwargs): |
| 27 | """ |
| 28 | Parameters |
| 29 | ---------- |
| 30 | bounds : [x0, y0, width, height], optional |
| 31 | Lower-left corner of rectangle to be marked, and its width |
| 32 | and height. If not set, the bounds will be calculated from the |
| 33 | data limits of inset_ax, which must be supplied. |
| 34 | |
| 35 | inset_ax : `~.axes.Axes`, optional |
| 36 | An optional inset Axes to draw connecting lines to. Two lines are |
| 37 | drawn connecting the indicator box to the inset Axes on corners |
| 38 | chosen so as to not overlap with the indicator box. |
| 39 | |
| 40 | zorder : float, default: 4.99 |
| 41 | Drawing order of the rectangle and connector lines. The default, |
| 42 | 4.99, is just below the default level of inset Axes. |
| 43 | |
| 44 | **kwargs |
| 45 | Other keyword arguments are passed on to the `.Rectangle` patch. |
| 46 | """ |
| 47 | if bounds is None and inset_ax is None: |
| 48 | raise ValueError("At least one of bounds or inset_ax must be supplied") |
| 49 | |
| 50 | self._inset_ax = inset_ax |
| 51 | |
| 52 | if bounds is None: |
| 53 | # Work out bounds from inset_ax |
| 54 | self._auto_update_bounds = True |
| 55 | bounds = self._bounds_from_inset_ax() |
| 56 | else: |
| 57 | self._auto_update_bounds = False |
| 58 | |
| 59 | x, y, width, height = bounds |
| 60 | |
| 61 | self._rectangle = Rectangle((x, y), width, height, clip_on=False, **kwargs) |
| 62 | |
| 63 | # Connector positions cannot be calculated till the artist has been added |
| 64 | # to an axes, so just make an empty list for now. |
| 65 | self._connectors = [] |
| 66 | |
| 67 | super().__init__() |
| 68 | self.set_zorder(zorder) |
| 69 | |
| 70 | # Initial style properties for the artist should match the rectangle. |
| 71 | for prop in _shared_properties: |
| 72 | setattr(self, f'_{prop}', artist.getp(self._rectangle, prop)) |
| 73 | |
| 74 | def _shared_setter(self, prop, val): |
| 75 | """ |
nothing calls this directly
no test coverage detected