plotly / plotly/plotly.py

Bug report: Incorrect drawing order of Isosurfaces with opacity

オープン
#5,268 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P2
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

  • 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:

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、提供された Python の再現コードを Chrome で実行し、opacity 0.99 と 1 の場合の isosurface と volume rendering を比較します。不透明およびほぼ不透明な Isosurfaces、multisurfaces、volume plots のレンダリングパスを調査します。提供されたケースが正しい順序で描画され、完全に不透明なレンダリングにリグレッションが発生しなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data-visualization
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。