widgets#
Custom matplotlib widgets made for use in this library.
- class RangeSlider(ax, label, valmin, valmax, valinit=None, valfmt=None, closedmin=True, closedmax=True, dragging=True, valstep=None, orientation='horizontal', **kwargs)[source]#
Bases:
SliderBase
A slider representing a floating point range.
Create a slider from valmin to valmax in axes ax. For the slider to remain responsive you must maintain a reference to it. Call
on_changed()
to connect to the slider event.- Attributes:
- valtuple[float]
Slider value.
- on_changed(func)[source]#
Attach a callback to when the slider is changed.
- Parameters:
- funccallable
Function to call when slider is changed. The function must accept a numpy array with shape (2,) float as its argument.
- Returns:
- int
Connection id (which can be used to disconnect func)
- set_max(val)[source]#
Set the lower value of the slider to val.
- Parameters:
- valfloat
The value to set the max to.
- class SliderBase(ax, orientation, closedmin, closedmax, valmin, valmax, valfmt, dragging, valstep)[source]#
Bases:
AxesWidget
Base Class for all sliders.
- 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)).
- 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)