[BUG]: contours.size initialization does not apply the specified value, but updates via dropdown work correctly
オープン
まだ誰も着手していません。
bug
good first issue
good for agent
P3
size: 1
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
Description
When initializing a go.Contour trace with a specific contours.size value (e.g., 0.25), the setting is ignored on the initial render, and Plotly defaults to an automatically calculated contour step size.
Interestingly, if the exact same parameter ("contours.size") is later updated dynamically via a layout updatemenus dropdown using the "restyle" method, the chart correctly updates and respects the specified size.
Screenshots/Video
- Initial Render (Buggy): The contours are spaced at default intervals despite
contours.size=0.25being passed to the constructor.
- After Selecting Dropdown (Expected): Selecting "Contour Size: 0.25" from the dropdown forces the chart to restyle, properly displaying the dense 0.25-step contour lines.
Steps to reproduce
- Run the provided Python snippet using
plotly.py. - Observe the initial plot render: notice that the contour lines do not match a step size of 0.25.
- Click the dropdown menu at the top left of the figure.
- Select the "Contour Size: 0.25" option.
- Notice that the plot immediately visualizes a much denser set of contours, behaving as it should have upon initialization.
import plotly
import plotly.graph_objects as go
print(f"Plotly version: {plotly.__version__}")
z_data = [
[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5.0, 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10],
]
fig = go.Figure(
data=go.Contour(
z=z_data,
contours=dict(size=0.25),
colorbar=dict(
title=dict(
text="Color bar title",
side="right",
font=dict(size=14, family="Arial, sans-serif"),
)
),
)
)
# This assertion passes, proving the property is registered in python-land
assert fig.data[0].contours.size == 0.25
fig.update_layout(
updatemenus=[
dict(
type="dropdown",
buttons=[
dict(
label="Contour Size: 0.25",
method="restyle",
args=[{"contours.size": 0.25}],
),
dict(
label="Contour Size: 1.0",
method="restyle",
args=[{"contours.size": 1.0}],
),
dict(
label="Contour Size: 2.0",
method="restyle",
args=[{"contours.size": 2.0}],
),
],
)
]
)
fig.show()
Notes
- The internal Python object structure correctly holds the
contours.sizevalue (as verified by the passingassert fig.data[0].contours.size == 0.25statement). - The version of plotly.py is 6.8.0.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された Python の再現コードから始め、特に go.Contour と contours.size の代入を確認してから、初期レンダリングと layout updatemenus の restyle パスを比較してください。コンストラクターの値がどこでレンダリングに渡されるかを追跡し、初期値 contours.size が 0.25 の場合に、ドロップダウンオプションを選択した場合と同じ等高線間隔になることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- plotly, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 55/100