fastplotlib.LinearRegionSelectorΒΆ

class LinearRegionSelector(bounds, limits, size, origin, axis='x', parent=None, resizable=True, fill_color=(0, 0, 0.35), edge_color=(0.8, 0.8, 0), edge_thickness=3, arrow_keys_modifier='Shift', name=None)[source]ΒΆ

Create a LinearRegionSelector graphic which can be moved only along either the x-axis or y-axis. Allows sub-selecting data from a Graphic or from multiple Graphics.

bounds[0], limits[0], and position[0] must be identical.

Holding the right mouse button while dragging an edge will force the entire region selector to move. This is a when using transparent fill areas due to pygfx picking limitations.

Note: Events get very weird if the values of bounds, limits and origin are close to zero. If you need a linear selector with small data, we recommend scaling the data and then using the selector.

Parameters:
  • bounds ((int, int)) – the initial bounds of the linear selector

  • limits ((int, int)) – (min limit, max limit) for the selector

  • size (int) – height or width of the selector

  • origin ((int, int)) – initial position of the selector

  • axis (str, default "x") – β€œx” | β€œy”, axis for the selector

  • parent (Graphic, default None) – associate this selector with a parent Graphic

  • resizable (bool) – if True, the edges can be dragged to resize the width of the linear selection

  • fill_color (str, array, or tuple) – fill color for the selector, passed to pygfx.Color

  • edge_color (str, array, or tuple) – edge color for the selector, passed to pygfx.Color

  • arrow_keys_modifier (str) – modifier key that must be pressed to initiate movement using arrow keys, must be one of: β€œControl”, β€œShift”, β€œAlt” or None

  • name (str) – name for this selector graphic

Features

selection: LinearRegionSelectionFeature

selection() returns the current selector bounds in world coordinates. Use get_selected_indices() to return the selected indices in data space, and get_selected_data() to return the selected data. Use selection.add_event_handler() to add callback functions that are called when the LinearSelector selection changes. See feature class for event pick_info table.