mpl_interactions.widgets module#

Custom matplotlib widgets made for use in this library.

class SliderBase(ax, orientation, closedmin, closedmax, valmin, valmax, valfmt, dragging, valstep)[source]#

Bases: AxesWidget

Base Class for all sliders.

disconnect(cid)[source]#

Remove the observer with connection id cid.

Parameters:
cidint

Connection id of the observer to be removed

reset()[source]#

Reset the slider to the initial value.

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

Bases: AxesWidget

A widget for selecting a point in a scatter plot. callback will receive (index, (x, y)).

on_changed(func)[source]#

When a point is clicked calll func with the newly selected point.

Parameters:
funccallable

Function to call when slider is changed. The function must accept a (int, tuple(float, float)) as its arguments.

Returns:
int

Connection id (which can be used to disconnect func)

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

Bases: scatter_selector

A widget for selecting a point in a scatter plot.

Callbacks will receive the index of the selected point as an argument.

on_changed(func)[source]#

Attach a callback for when points are selected.

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

Parameters:
funccallable

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)

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

Bases: scatter_selector

A widget for selecting a point in a scatter plot.

Callbacks will receive the x,y position of the selected point as arguments.

on_changed(func)[source]#

Attach a callback for when points are selected.

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

Parameters:
funccallable

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)