Completely excluding a trace from hover info/snapping

Hi,

I have a scenario where my figure contains a mesh3d with scatter3d on top of it. Problem is that I only need howverinfo from scatter3d. The intention is to have mesh3d just as a background, data coming from scatter3d

I have set hovermode for mesh3d to ā€œnoneā€ (tried ā€œskipā€ too), but there are two issues with that.

  • mouse cursor still snaps to mesh vertices
  • since itā€™s 3d, some points of scatter3d are ā€œinsideā€ or obscured by mesh3d (Iā€™ve made it almost transparent.). When hovering over obscured scatter3d points, cursor doesnā€™t snap to them, it snaps to mesh3d instead and no hover data is displayed, since mesh3d takes over.

re-ordering traces doesnā€™t help.

Any ideas would be greatly appreciated.

1 Like

Hi @asm_34

Set hoverinfo='skip' in your Meshd trace definition. Depending on what surface is represented by Mesh3d, you can perform a trick, as I did for the sphere and 3d points in this image:

I increased with 0.05 the radius of the sphere on which the 3d points are plotted, to avoid getting obscured points.

1 Like

Thanks for your reply. Unfortunately hoverinfo=ā€˜skipā€™ doesnā€™t solve the issue, as mouse cursor still snaps to mesh vertices, it only stops displaying hoverinfo.
Shrinking the mesh is not an option in my case due to mesh complexity.

Canā€™t really show the traces, but maybe that will give you a bit of idea what I am dealing with.

Annotation 2020-03-05 141432

@asm_34

I donā€™t understand what are you meaning by ...mouse cursor snaps to mesh I cannot catch the sense of the verb to snap, used in this context.

Mouse cursor snaps to vertices of the mesh3d (at least seems like it) when moved - similar to how it snaps to points in a scatter graph for example.

In my case it makes selecting scatter3d points difficult.

Thanks for your help so far - Iā€™ll try to get an example together in next couple of days.

I have the exact same use case and accompanying issue. I am trying to use the mesh as an overlay, however neither of the ā€˜skipā€™ or ā€˜noneā€™ settings appear to disable the hover behavior. Only the data points that form the vertices of the mesh trace are hover-able. The underlying scatter3d trace appears to not respond to hover events. Iā€™ve attached a screenshot to help visualize the problem.

Hi @Afroz,
Could you, please, paste here your definition of Mesh3d and Scatter3d trace? Also be more precise and tell what do you intend to be displayed on hover and what not.

I am hoping to use the mesh purely as an overlay with no hover events. The goal is to be able to hover only on the scatter trace markers. Currently, the mesh trace appears to be preventing any hover events on the scatter trace. My config is as basic as it gets:

[{
    alphahull: 7,
    opacity: 0.05,
    type: 'mesh3d',
    x: x,
    y: y,
    z: z,
    hoverinfo: 'skip'
},
{
    type: "scatter3d",
    mode: "markers+lines",
    x: x,
    y: y,
    z: z,
    text: t,
    hoverinfo: 'text',
    marker: {
        size: s,
        symbol: o,
        sizeref: 0.5,
    },
    line: {
        dash: 'dot',
        width: 1
    },
    transforms: [{
                type: "groupby",
                groups: c
            }]

@Afroz

For me it works with Plotly 4.5.4. Are you running an old Plotly version?

Iā€™m on the latest js version: 1.52.3

Just to be clear, I can hover on some markers - however, only the scatter markers that coincide with the mesh vertices/markers can be hovered. This is a small subset of all markers.

Apologies, I just realized Iā€™m on the Plotly.py support forumā€¦

Hi,

I tried a similar version of the code :

fig = go.Figure(data=[
    go.Mesh3d(
        x=[0, 0, 1, 1, 0, 0, 1, 1],
        y=[0, 1, 1, 0, 0, 1, 1, 0],
        z=[0, 0, 0, 0, 1, 1, 1, 1],
        color='gray',
        i=[7, 0, 0, 0, 4, 4, 6, 6, 4, 0, 3, 2],
        j=[3, 4, 1, 2, 5, 6, 5, 2, 0, 1, 6, 3],
        k=[0, 7, 2, 3, 6, 7, 1, 1, 5, 5, 7, 6],
        opacity=0.5,
        hoverinfo='skip'
    ),
    go.Scatter3d(
        x=[0.2, 0.3, 0.4],
        y=[0.2, 0.3, 0.4],
        z=[0.2, 0.3, 0.4],
        mode="markers",
        hoverinfo='text',
        text=['1', '2', '3'],
        marker=dict(size=5, symbol="circle",
                    )
    ),
])

Unfortunately I need to zoom in a lot to have the information on my scatter3d. I would like to access without needing to zoom and have hover information of my point like 3dmesh doesnā€™t exist at all. Is it possible ? Iā€™m using plotly 4.7 and it seems not working.

I have the same problem. Feitanā€™s code is a great minimal example of exactly my issue.

4 Likes

The same issue here.
Is difficult to focus on the data point if there is a surface behind, even if the hoverinfo is set to skip

has anyone figured this out? i am having the same exact issue.

I have the exact same problem. For a given 3D surface which is supposed to be set as an overlay the points that sit inside the 3D shape cannot be hovered over even though the hoverinfo of the 3d shape (that is surrounding the points) is turned to skip or none :frowning:

Same issue here (I also found Hover info of scatter points through 3D mesh without solution), it seems the trace selection is resolved ignoring the hoverinfo=skip/none, then if itā€™s indeed skip/none it doesnā€™t show any hover, but it should instead keep resolving what trace is under the mouse cursor to be able to hover traces under any mesh.