Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Trisurf opacity

Is there a way to create a triangulated surface that is transparent? Specifically for figure factory tri-surfaces, like the ones here: https://plot.ly/python/trisurf/ . I’ve tried passing rgba values to colormap, but I’ve had no luck. Any thoughts?

@bob To make the trisurf transparent you have to update the first dict in the list fig['data'], as follows:

fig['data'][0].update(opacity=0.75)

*This is a Python, not a plotly.js question.

1 Like

Thanks a lot. This also illuminates how the tri-surf structure is stored in python, answering another question I had. I’ve also updated the tag.

@empet I was going to open a new question (and I will if you think I should), but this falls under the very same category. Updating the opacity as you suggested, I obtain a surface which doesn’t look quite right. For example, modifying the torus example from the aforementioned website and setting the opacity = 0.5, I get something that looks like this:

It is hard for me to say if this is a browser issue or the expected outcome or a bug. All the browsers on my machine produce the same output, so I could have something going on with my graphics.

The undesired effect grows with the number of triangles in the triangulation, so it is less noticeable with fewer triangles.

@bob A trisurf is approximated by triangles and I think that the common edge of two neighboring triangles changes their color, depending on the direction of light.
The surface being transparent we also see the triangles that otherwise are hidden, and the interference of nearby and faraway triangles makes the surface look as pieces of non-continuous varying color.