I adapted the Update image data in a performant manner section from the Example notebook to operate on a 3D numpy array with seismic data (dimensions of x, y, time), and I am really impressed with the performance:
My question:
Is there a way for the text on the slider to print/show time values in milliseconds [0 4 8… 6000] instead of sample number [0 1 2 … 1500]? In previous realizations with ipywidgetd I just used
rslt = interactive(seismic_plot_function, w=IntSlider(min=0, max=6000,
step=1, value = 100))
display(rslt)
whereby as w is changed by the slider, it is calculated to index into the times array to get a t which is then passed to a text box inside the same seismic_plot_function , something like:
ax3.text(0.65, 2, 'two way time = {0:.2f}'.format(t), ha="center",
va="center", size=18, bbox=bbox_props)
I’ll also note that you can get the same performance as that example using mpl-interactions’ imshow function: Imshow — mpl-interactions 0.17.8 documentation. which has some slider formatting options.
If you want to do it manually you have a few options:
Thanks for your quick reply @ianhi, and the variety of options.
I will be checking out all the options you suggest, but I think it would be safe to accept this as the answer (except I cannot see how to do it? It is possible on other Discourse sites)