plotly / plotly/plotly.py

wrong customdata shape in go.Surface

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

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

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

説明

It appears that I have found a bug when using customdata with go.Surface. In the following example, I have discretized two directions with a different number of points. The tooltip is going to visualize information coming from x, y, z coordinates as well as customdata.

import numpy as np
import plotly.graph_objects as go
import plotly.express as px

x = np.linspace(-3, 3, 50)
y = np.linspace(-5, 5, 100)
x, y = np.meshgrid(x, y)
z = np.sqrt(x + 1j * y)
angle = np.angle(z)
z = np.absolute(z)

fig = go.Figure()
skw = dict(
    showscale=True,
    colorbar=dict(
        title="Argument",
        titleside="right",
        tickvals = [
            -np.pi,
            -np.pi / 2,
            0,
            np.pi / 2,
            np.pi,
        ],
        ticktext = [
            "-π",
            "-π / 2",
            "0",
            "π / 2",
            "π",
        ]
    ),
    cmin = -np.pi,
    cmax = np.pi,
    colorscale=px.colors.sequential.Rainbow,
    surfacecolor=angle,
    customdata=angle,
    hovertemplate="x: %{x}<br />y: %{y}<br />Abs: %{z}<br />Arg: %{customdata}",
)
fig.add_trace(
    go.Surface(x=x, y=y, z=z, **skw)
)
fig

This is the output picture. You can see a discontinuity at y=0. However, if you move the mouse on the right of the discontinuity, customdata won't show up.

On the other hand, if I'm going to use customdata=angle.T, than the tooltip will show the correct data.

I believe that customdata should have the same shape as the x, y, z coordinates.

newplot(8)

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

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

はじめの一歩

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

調査の方向性

go.Surface と NumPy 配列を使用した、提供されている Python の再現コードから始め、x、y、z の非正方形の形状に対して customdata がどのように使用されるかに注目してください。customdata=angle と customdata=angle.T の動作を比較します。不連続点の両側で tooltip に customdata が正しく表示されれば、issue は完了です。

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

評価

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

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

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