Skip to content

Conversation

@kushalkolar
Copy link
Member

starts #142

wonky right now with the controls, need to make it move along exactly with the deltas of the mouse

from fastplotlib.graphics.selectors.linear import LinearSelector
from fastplotlib import Plot
import numpy as np
from ipywidgets import VBox

ls = LinearSelector((0, 100), 300, (0, 0))

plot1 = Plot()

xs = np.linspace(0, 400, 1000)
sine = np.sin(xs) * 100

sg = plot1.add_line(sine)
plot1.add_graphic(ls)

plot2 = Plot()
zoomed = plot2.add_line(np.zeros(100))

def set_zoom_plot(ev):
    bounds = ev.pick_info["new_data"]
    
    zoomed.data = sg.data()[100:200]
    zoomed.data= sg.data()[bounds[0]:bounds[1]]
    plot2.auto_scale()


ls.bounds.add_event_handler(set_zoom_plot)

VBox([plot1.show(), plot2.show()])
linear_region-2023-03-05_06.54.19.mp4

@clewis7
Copy link
Member

clewis7 commented Mar 8, 2023

Is this to replace adding a line to trace over temporal traces in sync with slider?

kushalkolar and others added 25 commits March 8, 2023 23:33
ImageWidget fix frame_apply(), add grid_plot_kwargs(), reset_vmin_vmax()
temporary workaround for image and heatmap data buffers
garbage collection of WorldObjects
@kushalkolar
Copy link
Member Author

superseeded by #164

@kushalkolar kushalkolar deleted the selectors branch May 23, 2023 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants