-
Notifications
You must be signed in to change notification settings - Fork 50
LinearRegionSelector #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LinearRegionSelector #164
Conversation
@clewis7 Some ideas on how to make these easy to use: Just add a method to all graphics where it makes sense, like line = plot.add_line(...)
selector = line.add_linear_selector(resizable=True) # by default sets initial bounds as 20% of the data size
# similar syntax for heatmap Would be nice to have a simple API to automatically link one Graphic to another using a selector. For example a heatmap to line stack. The selector does have access to the parent selector = heatmap.add_linear_selector(...)
# sets the target's data with the sub-data from the selection, interpolates if necessary
selector.link("bounds", target=line, feature="data", interpolate=True)
# or change some other feature, like color?
selector.link("bounds", target=line, feature="colors", new_data="w") If they want full manual control for something more complex: from fastplotlib.graphics.selectors import LinearSelector
# do complex stuff
ls = LinearSelector(
bounds,
limits,
height,
position,
resizable=True
) |
This looks great. I am not sure from reading just the parameter names what the difference between I agree that creating abstractions so people can just attach these to data types so it works out of the box would be pretty amazing! |
More things to add to this and future selectors:
Yea if you have better name ideas they're welcome. Just took a look at
😂
Yup and with having |
Should allow this to be vertical as well so that it can be used with histograms for pyqtgraph-like vmin vmax setters |
I just realized it's useful to have a "selectors" property on LineGraphic (and the collections) which returns selectors attached to them. Just iterate through plot_area.graphics and return those which have "g.parent is self" |
starts #142
LinearSelector.get_selected_data()
returns a view of the data, or a list of views if from a collection such as LineStackLinearBoundsFeature
manages events.LineGraphic.add_linear_region_selector()
, allows adding multiple selectors onto the same graphicLineCollection.add_linear_region_selector()
As we make more selectors we can think about making a more centralized implementation for
Graphic.add_<selector>
. This may or may not be possible due to the diveristy of selectors that apply to a given graphic. For example, you wouldn't use aLinearSelector
on aScatterGraphic
, and you wouldn't use aRectangleSelector
on aLineGraphic
.linear_selector_xy-2023-04-16_05.57.06.mp4