wrong customdata shape in go.Surface
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 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.

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从提供的 Python 复现开始,使用 go.Surface 和 NumPy 数组,重点关注 customdata 如何用于 x、y 和 z 的非方形形状。比较 customdata=angle 与 customdata=angle.T 的行为;当 tooltip 在不连续点的两侧都能正确显示 customdata 时,该 issue 即完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- numpy, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100