MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_draggable

Method set_draggable

lib/matplotlib/legend.py:1221–1253  ·  view source on GitHub ↗

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')

Source from the content-addressed store, hash-verified

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."""

Callers 4

__init__Method · 0.95
apply_callbackFunction · 0.80
test_get_set_draggableFunction · 0.80
legend_picking.pyFile · 0.80

Calls 2

DraggableLegendClass · 0.85
disconnectMethod · 0.45

Tested by 1

test_get_set_draggableFunction · 0.64