Enable or disable mouse dragging support of the legend. Parameters ---------- state : bool Whether mouse dragging is enabled. use_blit : bool, optional Use blitting for faster image composition. For details see :ref:`func-
(self, state, use_blit=False, update='loc')
| 1219 | return self.legendPatch.contains(mouseevent) |
| 1220 | |
| 1221 | def set_draggable(self, state, use_blit=False, update='loc'): |
| 1222 | """ |
| 1223 | Enable or disable mouse dragging support of the legend. |
| 1224 | |
| 1225 | Parameters |
| 1226 | ---------- |
| 1227 | state : bool |
| 1228 | Whether mouse dragging is enabled. |
| 1229 | use_blit : bool, optional |
| 1230 | Use blitting for faster image composition. For details see |
| 1231 | :ref:`func-animation`. |
| 1232 | update : {'loc', 'bbox'}, optional |
| 1233 | The legend parameter to be changed when dragged: |
| 1234 | |
| 1235 | - 'loc': update the *loc* parameter of the legend |
| 1236 | - 'bbox': update the *bbox_to_anchor* parameter of the legend |
| 1237 | |
| 1238 | Returns |
| 1239 | ------- |
| 1240 | `.DraggableLegend` or *None* |
| 1241 | If *state* is ``True`` this returns the `.DraggableLegend` helper |
| 1242 | instance. Otherwise this returns *None*. |
| 1243 | """ |
| 1244 | if state: |
| 1245 | if self._draggable is None: |
| 1246 | self._draggable = DraggableLegend(self, |
| 1247 | use_blit, |
| 1248 | update=update) |
| 1249 | else: |
| 1250 | if self._draggable is not None: |
| 1251 | self._draggable.disconnect() |
| 1252 | self._draggable = None |
| 1253 | return self._draggable |
| 1254 | |
| 1255 | def get_draggable(self): |
| 1256 | """Return ``True`` if the legend is draggable, ``False`` otherwise.""" |