Skip to content

Commit 3fa38e5

Browse files
committed
Added an example to the docstring of the on_selection function
1 parent a04bcaf commit 3fa38e5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: plotly/basedatatypes.py

+15
Original file line numberDiff line numberDiff line change
@@ -3857,6 +3857,21 @@ def on_selection(
38573857
Returns
38583858
-------
38593859
None
3860+
3861+
Examples
3862+
--------
3863+
>>> from plotly.callbacks import Points
3864+
>>> points = Points()
3865+
3866+
>>> def selection_fn(trace, points, selector):
3867+
... inds = points.point_inds
3868+
... # Do something
3869+
3870+
>>> trace.on_selection(selection_fn)
3871+
3872+
Note: The creation of the `points` object is optional,
3873+
it's simply a convenience to help the text editor perform completion
3874+
on the `points` arguments inside `selection_fn`
38603875
"""
38613876
if not append:
38623877
del self._select_callbacks[:]

0 commit comments

Comments
 (0)