Defines the LassoSelection controller class.

class, *args, **kw)

Bases: chaco.abstract_controller.AbstractController

A controller that represents the interaction of “lassoing” a set of points.

“Lassoing” means drawing an arbitrary selection region around the points by dragging the mouse along the outline of the region.

dataspace_points = Property(Array)

An Nx2 array of points in data space representing all selected points.

disjoint_selections = Property(List)

A list of all the selection polygons.

drag_button = Enum("left", "right")

The button which this tool responds to

event_state = Enum("normal", "selecting")

The possible event states of this selection tool (overrides enable.Interactor).


Nothing has been selected, and the user is not dragging the mouse.


The user is dragging the mouse and is actively changing the selection region.

incremental_select = Bool(False)

If True, the selection mask is updated as the mouse moves, rather than only at the beginning and end of the selection operation.

metadata_name = Str("selection")

The name of the metadata on the datasource that we will write the selection mask to


Handles the user pressing a key in the ‘normal’ state.

If the user presses the Escape key, the tool is reset.


Handles the left mouse button being pressed while the tool is in the ‘normal’ state.

Puts the tool into ‘selecting’ mode, and starts defining the selection.

plot = Property

Mapping from screen space to data space. By default, it is just self.component.


Handles the mouse leaving the plot when the tool is in the ‘selecting’ state.

Ends the selection operation.


Handles the mouse moving when the tool is in the ‘selecting’ state.

The selection is extended to the current mouse position.


Handles the mouse button coming up in the ‘selecting’ state.

Completes the selection and switches to the ‘normal’ state.

selection_changed = Event

Fires when the selection mask changes.

selection_completed = Event

Fires when the user release the mouse button and finalizes the selection.

selection_datasource = Instance(AbstractDataSource)

The data source that the mask of selected points is attached to. Note that the indices in this data source must match the indices of the data in the plot.

selection_mode = Enum("include", "exclude", "invert")

The selection mode of the lasso pointer: “include”, “exclude” or “invert” points from the selection. The “include” and “exclude” settings essentially invert the selection mask. The “invert” setting differs from “exclude” in that “invert” inverses the selection of all points the the lasso’ed polygon, while “exclude” operates only on points included in a previous selection.

updated = Event

Fires whenever dataspace_points changes, necessitating a redraw of the selection region.