Wrapper around a `.Legend` to support mouse dragging. Parameters ---------- legend : `.Legend` The `.Legend` instance to wrap. use_blit : bool, optional Use blitting for faster image composition. For details see :ref:`func
(self, legend, use_blit=False, update="loc")
| 53 | |
| 54 | class DraggableLegend(DraggableOffsetBox): |
| 55 | def __init__(self, legend, use_blit=False, update="loc"): |
| 56 | """ |
| 57 | Wrapper around a `.Legend` to support mouse dragging. |
| 58 | |
| 59 | Parameters |
| 60 | ---------- |
| 61 | legend : `.Legend` |
| 62 | The `.Legend` instance to wrap. |
| 63 | use_blit : bool, optional |
| 64 | Use blitting for faster image composition. For details see |
| 65 | :ref:`func-animation`. |
| 66 | update : {'loc', 'bbox'}, optional |
| 67 | If "loc", update the *loc* parameter of the legend upon finalizing. |
| 68 | If "bbox", update the *bbox_to_anchor* parameter. |
| 69 | """ |
| 70 | self.legend = legend |
| 71 | |
| 72 | _api.check_in_list(["loc", "bbox"], update=update) |
| 73 | self._update = update |
| 74 | |
| 75 | super().__init__(legend, legend._legend_box, use_blit=use_blit) |
| 76 | |
| 77 | def finalize_offset(self): |
| 78 | if self._update == "loc": |