mpl_interactions.widgets.scatter_selector_index

class scatter_selector_index(ax, x, y, pickradius=5, which_button=1, **kwargs)[source]

Bases: mpl_interactions.widgets.scatter_selector

A widget for selecting a point in a scatter plot. callback will receive the index of the selected point as an argument.

Attributes
active

Is the widget active?

Methods

connect_event(event, callback)

Connect callback with an event.

disconnect_events()

Disconnect all events created by this widget.

get_active()

Get whether the widget is active.

ignore(event)

Return whether event should be ignored.

on_changed(func)

When a point is clicked calll func with the newly selected point’s index and position as arguments.

set_active(active)

Set whether the widget is active.

__init__(ax, x, y, pickradius=5, which_button=1, **kwargs)[source]

Create the scatter plot and selection machinery.

Parameters
  • ax (Axes) – The Axes on which to make the scatter plot

  • x, y (float or array-like, shape (n, )) – The data positions.

  • pickradius (float) – Pick radius, in points.

  • which_button (int, default: 1) – Where 1=left, 2=middle, 3=right

Other Parameters

**kwargs (arguments to scatter) – Other keyword arguments are passed directly to the ax.scatter command

Methods

__init__(ax, x, y[, pickradius, which_button])

Create the scatter plot and selection machinery.

connect_event(event, callback)

Connect callback with an event.

disconnect_events()

Disconnect all events created by this widget.

get_active()

Get whether the widget is active.

ignore(event)

Return whether event should be ignored.

on_changed(func)

When a point is clicked calll func with the newly selected point’s index and position as arguments.

set_active(active)

Set whether the widget is active.

Attributes

active

Is the widget active?

drawon

eventson

on_changed(func)[source]

When a point is clicked calll func with the newly selected point’s index and position as arguments.

Parameters

func (callable) – Function to call when slider is changed. The function must accept a single int as its arguments.

Returns

int – Connection id (which can be used to disconnect func)