Skip to content
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/notebooks/screenshots/nb-image-widget-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/screenshots/image_volume_render_modes.png
4 changes: 2 additions & 2 deletions examples/screenshots/image_widget.png
4 changes: 2 additions & 2 deletions examples/screenshots/image_widget_grid.png
4 changes: 2 additions & 2 deletions examples/screenshots/image_widget_imgui.png
4 changes: 2 additions & 2 deletions examples/screenshots/image_widget_single_video.png
4 changes: 2 additions & 2 deletions examples/screenshots/image_widget_videos.png
4 changes: 2 additions & 2 deletions examples/screenshots/image_widget_viewports_check.png
4 changes: 2 additions & 2 deletions examples/screenshots/linear_selector.png
4 changes: 2 additions & 2 deletions examples/screenshots/no-imgui-linear_selector.png
3 changes: 2 additions & 1 deletion examples/selection_tools/linear_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Linear Selectors
================

Example showing how to use a `LinearSelector` with lines and line collections.
Example showing how to use a `LinearSelector` with lines and line collections. The linear selector is the yellow
vertical line.
"""

# test_example = true
Expand Down
9 changes: 5 additions & 4 deletions examples/selection_tools/linear_selector_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
Linear Selectors Image
======================

Example showing how to use a `LinearSelector` to selector rows or columns of an image. The subplot on the right
displays the data for the selector row and column.
Example showing how to use a `LinearSelector` to select rows or columns of an image. The subplot on the right
displays the data for the selector row and column. Move the selectors independently or click the middle mouse
button to move both selectors to the clicked location.
"""

# test_example = false
Expand All @@ -24,10 +25,10 @@
image = figure[0, 0].add_image(image_data)

# add a row selector
image_row_selector = image.add_linear_selector(axis="y")
image_row_selector = image.add_linear_selector(axis="y", edge_color="cyan")

# add column selector
image_col_selector = image.add_linear_selector()
image_col_selector = image.add_linear_selector(edge_color="cyan")

# make a line to indicate row data
line_image_row = figure[0, 1].add_line(image.data[0])
Expand Down
3 changes: 3 additions & 0 deletions examples/selection_tools/unit_circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def set_x_val(ev):
sine_selector.add_event_handler(set_x_val, "selection")
cosine_selector.add_event_handler(set_x_val, "selection")

# set initial position of the selector so it's not just overlapping the y-axis
sine_selector.selection = 100

figure.show()


Expand Down
18 changes: 9 additions & 9 deletions fastplotlib/graphics/features/_selection_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def set_value(self, selector, value: float):
elif self._axis == "y":
dim = 1

for edge in selector._edges:
edge.geometry.positions.data[:, dim] = value
edge.geometry.positions.update_range()
edge = selector._edges[0]
edge.geometry.positions.data[:, dim] = value
edge.geometry.positions.update_range()

self._value = value

Expand Down Expand Up @@ -152,10 +152,10 @@ def set_value(self, selector, value: Sequence[float]):
selector.fill.geometry.positions.data[mesh_masks.x_right] = value[1]

# change x position of the left edge line
selector.edges[0].geometry.positions.data[:, 0] = value[0]
selector._edges[0].geometry.positions.data[:, 0] = value[0]

# change x position of the right edge line
selector.edges[1].geometry.positions.data[:, 0] = value[1]
selector._edges[1].geometry.positions.data[:, 0] = value[1]

elif self.axis == "y":
# change bottom y position of the fill mesh
Expand All @@ -165,18 +165,18 @@ def set_value(self, selector, value: Sequence[float]):
selector.fill.geometry.positions.data[mesh_masks.y_top] = value[1]

# change y position of the bottom edge line
selector.edges[0].geometry.positions.data[:, 1] = value[0]
selector._edges[0].geometry.positions.data[:, 1] = value[0]

# change y position of the top edge line
selector.edges[1].geometry.positions.data[:, 1] = value[1]
selector._edges[1].geometry.positions.data[:, 1] = value[1]

self._value = value

# send changes to GPU
selector.fill.geometry.positions.update_range()

selector.edges[0].geometry.positions.update_range()
selector.edges[1].geometry.positions.update_range()
selector._edges[0].geometry.positions.update_range()
selector._edges[1].geometry.positions.update_range()

# send event
if len(self._event_handlers) < 1:
Expand Down
Loading
Loading