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 heatmapWould 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 LineStackLinearBoundsFeaturemanages 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 aLinearSelectoron aScatterGraphic, and you wouldn't use aRectangleSelectoron aLineGraphic.linear_selector_xy-2023-04-16_05.57.06.mp4