Skip to content

Using opacityscale with surface results in ordering by addition order, not depth #4918

Open
@wkumler

Description

@wkumler

Hi all, been using plotly with R for a while now and really loving it - thanks for assembling such a phenomenal program! I'd like to report a bug found while plotting multiple surface objects, which causes them to layer in the order they're added rather than the "depth" at which they should really render in the figure. See this codepen for code and examples, which are also rendered below as screenshots.

I previously posted in ropensci/plotly, but have since learned enough Javascript to assemble the codepen and the issue persists, making me think it's not an R problem. There's also no discussion of the new "opacityscale" feature there and a lively discussion here, making me hopeful that more people will have some idea how I might fix this if it isn't a bug.

This is great:

image

This is less great (same figure rotated to look from below):

image

It seems that the surface that renders always on "top" is the one that's added last in the data array. If we alter the above code a little bit to render the top layer surface before the middle one, we get some more interesting results:

Plotly.newPlot('graphDivReorderOpac', [data_z1, data_z3, data_z2]); rather than Plotly.newPlot('graphDivReorderOpac', [data_z1, data_z2, data_z3]);

image

image

Apologies for the repetitive code in the codepen - I really did learn just enough JS to make this one and will be hiding behind R wrappers in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions