Update one figure based on hover/click on another figure

Apologies if this is more of a bokeh/plotly question than a streamlit question, but I have been digging around and can’t find a great answer.

I have a 2D array where every element corresponds to an additional 1D array. I would like to display the 2D array as an image, and use bokeh or plotly so that when the mouse hovers over or clicks on an individual pixel, a second figure shows a line plot of the corresponding 1D array for that pixel.

It seems like bokeh and plotly cannot natively pass hover information back to streamlit, but I have seen some custom components with workarounds - can anyone tell me if this is feasible?

Thanks!