plotly / plotly/plotly.py

graph_objs.volume and .isosurface not rendering non-cuboid

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

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

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

説明

I'm trying to use plotly in a dash app to render a cuboid, that's sheared to the y-axis.=it has a parallelogram as ground surface. It consists of individual points, each with a density value. plotly_express.scatter_3d renders the individual points correctly, but only has "2 views" when rotating it:

  • One where the closest face is rendered
  • -> you can't look inside very well
  • One where both the closest face and the inside of the structure are not rendered
  • -> you can only see the 2 rear side faces, but from the inside

With both, I'm losing a lot of information on the insides of my structure.
I think scatter_3d doesn't allow for

  • a) all points to stay rendered at all times
  • b) me to link each individual points opacity to its density value (like it does with color)¹

Best looking solution would be graph_objs.Volume or .isosurface, but they have an issue.

So far, the coordinates data had to be arranged to form an orthogonal cuboid, to render a volume.
My test data is not the same y-sheared cuboid I want to achieve, but it illustrates the issue of both graph_objs.

Test Data:
Using plotly_express.scatter_3d() for comparison, the following dataframe shows both Figures rendering the expected result:

DF = pd.DataFrame(data={
    'x': [0, 0, 0, 0, 0, 0, 1,1,1,1,1,1],
    'y': [0,0,0,1,1,1,0,0,0,1,1,1],
    'z': [0,1,2,0,1,2,0,1,2,0,1,2],
    'val': [1,1,1,1,1,1,1,1,1,1,1,1]})

scatter plot:
points

volume plot:
points volume

When removing 2 points at (0/1/2) & (1/1/2) -

DF = pd.DataFrame(data={
    'x': [0, 0, 0, 0, 0, 1,1,1,1,1],
    'y': [0,0,0,1,1,0,0,0,1,1],
    'z': [0,1,2,0,1,0,1,2,0,1],
    'val': [1,1,1,1,1,1,1,1,1,1]})
  • go.Volume breaks.

scatter plot:
scattermissing

volume plot:
vol missing

scatter_3d figure:

px.scatter_3d(
    DF,
    x='x',
    y='y',
    z='z',
    color='val',
    opacity=0.5,
    color_continuous_scale=px.colors.sequential.Inferno_r,
    range_color=[df.min()['val'], df.max()['val']],
    template=templ)

opacity doesn't take lists/ranges, so I can't use DF.val there.

Volume figure:

go.Figure(data=go.Volume(
    x=DF.x,
    y=DF.y,
    z=DF.z,
    value=DF.val,
    opacity=0.3,
    surface_count=17,
    colorscale=px.colors.sequential.Inferno_r
))

I played around with surface_count, but it doesn't seem to be causing the problem.

My 2 points being:

  • go.Volume/.isosurface don't work if angles of !=90° are involved
  • px.scatter_3d deserves some more configuration-options, especially opacity-wise

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

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

はじめの一歩

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

調査の方向性

完全なデータセットと欠損点のあるデータセットを含め、提供された plotly_express.scatter_3d と go.Volume の例を再現する。まず go.Volume と go.Isosurface のエントリーポイントから始め、せん断された座標と欠損点に対する動作を比較する。Done では、これらの入力がサポートされているかを明らかにし、観測されたレンダリング上の制限を解決するか、明確に文書化する必要がある。

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

評価

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

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

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