get_selected_data#

LinearRegionSelector.get_selected_data(graphic=None)[source]#

Get the Graphic data bounded by the current selection. Returns a view of the data array.

If the Graphic is a collection, such as a LineStack, it returns a list of views of the full array. Can be performed on the parent Graphic or on another graphic by passing to the graphic arg.

NOTE: You must be aware of the axis for the selector. The sub-selected data that is returned will be of shape [n_points_selected, 3]. If you have selected along the x-axis then you can access y-values of the subselection like this: sub[:, 1]. Conversely, if you have selected along the y-axis then you can access the x-values of the subselection like this: sub[:, 0].

Parameters:

graphic (Graphic, optional, default None) – if provided, returns the data selection from this graphic instead of the graphic set as parent

Returns:

view or list of views of the full array, returns None if selection is empty

Return type:

np.ndarray or List[np.ndarray]