✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Change other sub-figure on-hover?

I have two plotly figures that I plot one next to the other in the following manner:

ef visualize_mesh_pair(

        color_map_vis = create_colormap(source_mesh.vert)
        fig = make_subplots(
                "type": "mesh3d"
            }, {
                "type": "mesh3d"
        fig.add_trace(self.plotly_mesh(source_mesh, color_map_vis),
        fig.add_trace(self.plotly_mesh(target_mesh, color_map_vis[corr_map]),

With the following example image

And I also have a mapping between them, e.g shape0[i]->shape1[j] (using a simple numpy array where npa[i]=j

Is there a way to add an arrow on hover? or even a simple marker, that when I hover on shape 1, the corresponding point in shape 2 changes color/ has a pointer? (option A in red arrow, option B in black circle)


Unfortunately only for a 2d trace of a go.FigureWidget instance you can define a callback function for on_hover.
A workaround for your meshes is to add to each subplot one Scatter3d trace, consisting in a single mesh vertex, and update these scatter 3d traces simultaneously, via updatemenus buttons, to reveal the point correspondence.
Here https://chart-studio.plotly.com/~empet/15687 is an example with a 3d mesh and its copy (because I don’t have a deformed version of this mesh) to see how it works.

That’s amazing man, thanks a lot!
So just to make sure, I can add buttons, but not on-hover actions, (can I add invisible scatter 3d trace for each 3d mesh point, and create an action on that?)

In the example given in notebook is defined a scatter3d for a single invisible point, and the number of buttons is equal to the number of corresponding pairs to be displayed. Theoretically you can associate a button to each pair, but if the number of mesh vertices is big ( >1000) it is dificult to decide which index to choose from the dropdown menu, because you don’t know the position of the corresponding points.
You can perform an experiment with:

butons = [ ....   for idx in range(len(points))]

and then decide if such a solution is what you want.