GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow use of `add_*_selector` methods in `ScatterGraphic` by lkeegan · Pull Request #883 · fastplotlib/fastplotlib

Conversation

@lkeegan

@lkeegan lkeegan commented Jul 21, 2025

Copy link
Copy Markdown
  • move these existing methods from LineGraphic to common base clase PositionsGraphic
  • regenerate docs

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lkeegan
Allow use of add_*_selector methods in ScatterGraphic
acab9d0
- move these existing methods from `LineGraphic` to common base clase `PositionsGraphic`
- regenerate docs
@lkeegan
lkeegan requested review from clewis7 and kushalkolar as code owners July 21, 2025 14:03
@kushalkolar

kushalkolar commented Jul 21, 2025

Copy link
Copy Markdown
Member

Hi thanks for your PR!

Supporting selections for scatters will also require implementing the methods to get data from the selections, for example with the rectangle selector:

fastplotlib/fastplotlib/graphics/selectors/_rectangle.py

Line 295 in dac31cf

def get_selected_data(

fastplotlib/fastplotlib/graphics/selectors/_rectangle.py

Line 423 in dac31cf

def get_selected_indices(

I'm not sure what a linear or linear region selector means for a scatter, do you have a use case example? I can maybe see the usecase for exploring regression plots.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkeegan

lkeegan commented Jul 22, 2025

Copy link
Copy Markdown
Author

Hi thanks for your PR!

Supporting selections for scatters will also require implementing the methods to get data from the selections, for example with the rectangle selector:

fastplotlib/fastplotlib/graphics/selectors/_rectangle.py

Line 295 in dac31cf

def get_selected_data(

fastplotlib/fastplotlib/graphics/selectors/_rectangle.py

Line 423 in dac31cf

def get_selected_indices(

Thanks for your feedback - and for this very nice library! I'll look into updating these methods.

I'm not sure what a linear or linear region selector means for a scatter, do you have a use case example? I can maybe see the usecase for exploring regression plots.

I guess if one axis in the scatter is time it could make sense to select a time range of data using the linear region selector.
My personal use case is very basic - I just want to be able to select a time on linked plots of time series data, e.g. a line plot of voltage traces and a scatter plot of features extracted from these traces:

plots.mp4
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkeegan
Update linear/rectangle selectors to work with ScatterGraphics, add e…
5ae771e
…xamples
clewis7
clewis7 reviewed Jul 22, 2025
View reviewed changes

@clewis7 clewis7 left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lkeegan

Thanks again for making a PR! I had a few small questions/tweaks. I'm sure @kushalkolar will also want to take a look. I checked out your examples, and they look great!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread fastplotlib/graphics/_positions_base.py Outdated

# min/max limits
limits = (x_axis_vals[0], x_axis_vals[-1], ymin * 1.5, ymax * 1.5)
limits = (xmin, xmax, ymin, ymax)

@clewis7 clewis7 Jul 22, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the ymin * 1.5 and ymax * 1.5? I think we had that there to allow the selector to go a little bit above and below the graphic.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Jul 23, 2025

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry - I removed it because with positive ymin the limits didn't allow you to select all the data, restored in 75b7d73

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread fastplotlib/graphics/_positions_base.py
Comment on lines +336 to +342
axis_vals_min = np.floor(axis_vals.min()).astype(int)
axis_vals_max = np.floor(axis_vals.max()).astype(int)

bounds_init = axis_vals_min, axis_vals_min + 0.25 * (
axis_vals_max - axis_vals_min
)
limits = axis_vals_min, axis_vals_max

@clewis7 clewis7 Jul 22, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add code comments here?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Jul 23, 2025

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure: c5ec080

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
lkeegan added 2 commits July 23, 2025 08:06
@lkeegan
refactor bounds_init logic to make intent clearer, add comment, remov…
c5ec080
…e unused variables
@lkeegan
restore y-padding on rectangle selector limits, refactored to also wo…
75b7d73
…rk when ymin is positive
@clewis7

clewis7 commented Jul 23, 2025

Copy link
Copy Markdown
Member

@kushalkolar LGTM as long as the examples pass

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Jul 29, 2025

Copy link
Copy Markdown
Member

I'm going to wait until #837 is merged first since that changes some things with selectors.

lkeegan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lkeegan added 2 commits September 29, 2025 11:20
@lkeegan
Merge branch 'main' into scatter_graphic_add_linear_selector
c28163f
@lkeegan
Add add_polygon_selector method to ScatterGraphic and create an e…
e2d6b9f
…xample for it
@lkeegan

lkeegan commented Sep 30, 2025

Copy link
Copy Markdown
Author

@kushalkolar I've updated this PR to include the polygon selector from #837

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Oct 1, 2025

Copy link
Copy Markdown
Member

Thanks for the update! I'll try this out and merge after #904 so that I don't have to replace the ground truth screenshots multiple times, it will be merged soon! 😄

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar
kushalkolar reviewed Oct 1, 2025
View reviewed changes
Comment thread fastplotlib/graphics/selectors/_polygon.py
self._resizable = bool(resizable)

BaseSelector.__init__(self, name=name, parent=parent)
self._move_info = MoveInfo("none", -1, -1, None, None)

@kushalkolar kushalkolar Oct 1, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@almarklein I'm guessing this was a typo? 😆

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@almarklein almarklein Oct 2, 2025

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, the type of MoveInfo.mode was str. Though in _end_move_mode I did set it to None, so I was not consistent 😆.

So this change looks fine to me, especially with the type now also being mode: str | None.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread fastplotlib/graphics/scatter.py Outdated
xmin = np.floor(x_axis_vals.min()).astype(int)
xmax = np.ceil(x_axis_vals.max()).astype(int)

# min/max limits include the data + 25% padding in the y-direction

@kushalkolar kushalkolar Oct 1, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to pad in both x and y for a scatter?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Oct 1, 2025

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that makes sense

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
kushalkolar
kushalkolar reviewed Oct 1, 2025
View reviewed changes
Comment thread examples/selection_tools/linear_region_scatter.py Outdated
LinearRegionSelector which selects along the x-axis and a vertical selector which moves along the y-axis.
"""

# test_example = false

@kushalkolar kushalkolar Oct 1, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this true, we'd want to have a ground truth screenshot for this since it's a new feature.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Oct 1, 2025

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread examples/selection_tools/polygon_selector_scatter.py Outdated
Example showing how to use a `PolygonSelector` with a scatter plot.
"""

# test_example = false

@kushalkolar kushalkolar Oct 1, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this true, we'd want to have a ground truth screenshot for this since it's a new feature.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Oct 1, 2025

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread examples/selection_tools/rectangle_selector_scatter.py Outdated
Example showing how to use a `RectangleSelector` with a scatter plot.
"""

# test_example = false

@kushalkolar kushalkolar Oct 1, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this true, we'd want to have a ground truth screenshot for this since it's a new feature.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Oct 1, 2025

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kushalkolar kushalkolar mentioned this pull request Oct 1, 2025
add ImageVolumeGraphic #791
Merged
14 tasks done
lkeegan added 4 commits October 1, 2025 16:00
@lkeegan
allow selection to extend by 25% padding in all directions
8776b29
@lkeegan
enable ground truth screenshots for scatter selector examples
7898ad2
@lkeegan
set initial polygon selection in example and reset _move_info after s…
82870b9
…etting selection to complete selection
@lkeegan
Merge branch 'main' into scatter_graphic_add_linear_selector
9054ae0
@lkeegan

lkeegan commented Nov 10, 2025

Copy link
Copy Markdown
Author

@kushalkolar thanks for reviewing, I've made the suggested changes and merged the latest changes from the main branch

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar

kushalkolar commented Nov 10, 2025 via email

Copy link
Copy Markdown
Member
Thanks I haven't forgotten this! We're just very busy with other parts of the library at the moment.
…
On Mon, Nov 10, 2025, 09:33 Liam Keegan ***@***.***> wrote: *lkeegan* left a comment (fastplotlib/fastplotlib#883) <#883 (comment)> @kushalkolar <https://github.com/kushalkolar> thanks for reviewing, I've made the suggested changes and merged the latest changes from the main branch — Reply to this email directly, view it on GitHub <#883 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACHXXRCGFODJ34AGDBLM2YL34CO5DAVCNFSM6AAAAACB76T6VWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKMJSGA2DOMRRGY> . You are receiving this because you were mentioned.Message ID: ***@***.***>
lkeegan reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kushalkolar
kushalkolar requested changes Jan 30, 2026
View reviewed changes

@kushalkolar kushalkolar left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, sorry for the late response, lots of stuff on our plate lately

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread examples/selection_tools/linear_region_scatter.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_polygon.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/selectors/_linear_region.py
return source.data[s]

if "Scatter" in source.__class__.__name__:
return source.data[ixs]

@kushalkolar kushalkolar Jan 30, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always valid for an arbitrary scatter? What if we have a blob, like a Gaussian cloud? I think it's only valid for scatters that represent data which are a function of the x or y dim?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Jan 30, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's valid for any scatter data - it just returns the subset of data in the selected region:

image

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread fastplotlib/graphics/selectors/_rectangle.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread fastplotlib/graphics/_positions_base.py

self._size_space = SizeSpace(size_space)
super().__init__(*args, **kwargs)

@kushalkolar kushalkolar Jan 30, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update this w.r.t. the current methods

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkeegan lkeegan Jan 30, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6e5b923

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
lkeegan and others added 5 commits January 30, 2026 09:43
@lkeegan @kushalkolar
Update fastplotlib/graphics/selectors/_polygon.py
2b607b5
Co-authored-by: Kushal Kolar <[email protected]>
@lkeegan @kushalkolar
Update fastplotlib/graphics/selectors/_rectangle.py
5313a05
Co-authored-by: Kushal Kolar <[email protected]>
@lkeegan @kushalkolar
Update fastplotlib/graphics/selectors/_polygon.py
481138b
Co-authored-by: Kushal Kolar <[email protected]>
@lkeegan
run black on examples/selection_tools/linear_region_scatter.py
41c3a02
@lkeegan
Merge branch 'main' into scatter_graphic_add_linear_selector
4db8d34
lkeegan added 3 commits January 30, 2026 10:00
@lkeegan
update add_*_selector to match main branch (keeping previous changes …
6e5b923
…to support negative y-axis values)
@lkeegan
fix typos
4598ae0
@lkeegan
Add sizes to linear region scatter example
b0720b4
@lkeegan
lkeegan requested a review from kushalkolar January 30, 2026 10:59
@kushalkolar

kushalkolar commented Sep 22, 2026

Copy link
Copy Markdown
Member

Hi I'm going to close this, thanks for the effort but I think this use case is better served by the NDWidget which is now in main. It has a lot of applications for neuroscience.
https://www.fastplotlib.org/ver/dev/_gallery/ndwidget/raster.html
https://www.fastplotlib.org/ver/dev/_gallery/ndwidget/timeseries_cmaps.html

More info: https://www.fastplotlib.org/ver/dev/user_guide/nd_widget.html

If you're using claude code, the skill helps claude produce less-bad output for fastplotlib with neuroscience: https://github.com/fastplotlib/claude-skills

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kushalkolar kushalkolar closed this Sep 22, 2026
@lkeegan

lkeegan commented Sep 22, 2026

Copy link
Copy Markdown
Author

Hi I'm going to close this, thanks for the effort but I think this use case is better served by the NDWidget which is now in main. It has a lot of applications for neuroscience. https://www.fastplotlib.org/ver/dev/_gallery/ndwidget/raster.html https://www.fastplotlib.org/ver/dev/_gallery/ndwidget/timeseries_cmaps.html

More info: https://www.fastplotlib.org/ver/dev/user_guide/nd_widget.html

If you're using claude code, the skill helps claude produce less-bad output for fastplotlib with neuroscience: https://github.com/fastplotlib/claude-skills

@kushalkolar thanks, the skill is a great idea!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@almarklein almarklein almarklein left review comments
@clewis7 clewis7 clewis7 left review comments
@kushalkolar kushalkolar Awaiting requested review from kushalkolar kushalkolar is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@lkeegan @kushalkolar @clewis7 @almarklein
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.