add_pickerο
- cb.add_picker(name, artist, picker)ο
Attach a custom picker to an artist.
Once attached, callbacks can be assigned just like the default click/pick callbacks via:
>>> m.cb.pick__<name>. ...
- Parameters:
name (str, optional) β a unique identifier that will be used to identify the pick method.
artist (a matplotlib artist, optional) β the artist that should become pickable. (it must support artist.set_picker()) The default is None.
picker (callable, optional) β
A callable that is used to perform the picking. The default is None, in which case the default picker is used. The call-signature is:
>>> def picker(artist, mouseevent): >>> # if the pick is NOT successful: >>> return False, dict() >>> ... >>> # if the pick is successful: >>> return True, dict(ID, pos, val, ind)
Note
If the name starts with an underscore (e.g. β_MyPickerβ) then the associated container will be accessible via m.cb._pick__MyPicker or via m.cb.pick[β_MyPickerβ]. (This is useful to setup pickers that are only used internally)