Bug report: Incorrect drawing order of Isosurfaces with opacity
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- data-visualization
Research direction
Start by running the provided Python reproduction in Chrome and compare the isosurface and volume rendering at opacity 0.99 versus 1. Investigate the rendering path for opaque and nearly opaque Isosurfaces, multisurfaces, and volume plots. Done means the supplied cases draw in the correct order without regressing fully opaque rendering.
Written by the indexing model from the issue text.
Description
- Reported by Łukasz as a post on the forum
- Plotly version: 6.2.0
- Python version: 3.11.13
- Browser: chrome
Hi, i have found quite annoying bug which can be seen only when the isosurface components are opaque. I observed that it doesn’t only occur for multiple trace isosurfaces, but also single multisurface isosurfaces and volume plots.
Here is an example code how to replicate it:
(The fun part is that when you change the opacity from 0.99 to 1 the plot gets visualised properly.)
import plotly.graph_objects as go
import numpy as np
import nrrd
from skimage.transform import resize
volume = np.zeros((50, 50, 50))
volume[1:10, 5:45, 5:45] =1
volume[10:20, 5:45, 5:45] = 1.5
volume[20:30, 5:45, 5:45] = 2
volume[30:40, 5:45, 5:45] = 2.5
volume[40:49, 5:45, 5:45] = 3
Z, X, Y = np.mgrid[0:volume.shape[0]:1, 0:volume.shape[1]:1, 0:volume.shape[2]:1]
fig = go.Figure(data=[go.Isosurface(
x=X.flatten(),
y=Y.flatten(),
z=Z.flatten(),
opacity=0.99,
value=np.where(volume == 1, 1, 0).flatten(),
surface_fill=1,
surface_count=1,
colorscale=[[0, 'rgb(0,255,0)'], [1, 'rgb(0,255,0)']],
caps=dict(x_show=False, y_show=False, z_show=False),
#slices_z=dict(show=True, locations=list(range(volume.shape[0]))),
),
go.Isosurface(
x=X.flatten(),
y=Y.flatten(),
z=Z.flatten(),
opacity=0.99,
value=np.where(volume == 3, 1, 0).flatten(),
surface_fill=1,
surface_count=1,
colorscale=[[0, 'rgb(255,0,0)'], [1, 'rgb(255,0,0)']],
caps=dict(x_show=False, y_show=False, z_show=False),
# slices_z=dict(show=True, locations=list(range(volume.shape[0]))),
)])

The bug can be seen looking form under the plot:

- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 13h 41m
- Merged PRs (30d)
- 21
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from plotly/plotly.py
-
P3 size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
P3 size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug P1
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
feature P3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
feature P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in plotly/plotly.py
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·