go.Contour doesn't render correctly in animation frames when multiple traces are present
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- data-visualization
Hướng nghiên cứu
Bắt đầu bằng cách chạy ví dụ Python tối thiểu được cung cấp trong plotly.py và so sánh hoạt ảnh chỉ sử dụng go.Contour với hoạt ảnh có thêm các trace go.Scatter. Truy vết đường dẫn hoạt ảnh/kết xuất được Figure và Frame sử dụng cho dữ liệu đường đồng mức; hoàn thành có nghĩa là đường đồng mức được kết xuất chính xác trong suốt các frame khi có nhiều trace, mà không gây hồi quy đối với trường hợp một trace.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm encountering an issue with plotly.graph_objects.Figure animations. When using go.Contour inside go.Frame along with additional traces such as go.Scatter, the contour plot no longer renders correctly during animation. However, if I only include the go.Contour trace by itself in each frame, it animates perfectly.
Here's a minimal reproducible example:
import plotly.io as pio
pio.renderers.default = 'browser'
import plotly.graph_objects as go
import numpy as np
z_base = np.array([
[10, 10.625, 12.5, 15.625, 20],
[5.625, 6.25, 8.125, 11.25, 15.625],
[2.5, 3.125, 5., 8.125, 12.5],
[0.625, 1.25, 3.125, 6.25, 10.625],
[0, 0.625, 2.5, 5.625, 10]
])
lk_x=[0,0,1,1,0]
lk_y=[0,1,1,0,0]
data_line = go.Scatter(x=lk_x, y=lk_y, mode='lines', fill='toself', fillcolor='rgba(60, 53, 48, 0.5)', line_color='black', showlegend=False)
scales = np.linspace(0.2, 1.0, 10)
frames = []
for i, s in enumerate(scales):
z_scaled = z_base * s
frames.append(go.Frame(
data=[
go.Contour(
z=z_scaled,
colorbar=dict(
thickness=25,
thicknessmode='pixels',
len=0.6,
lenmode='fraction',
outlinewidth=0
)
,zorder=2
),
go.Scatter(
x=[0, 1, 2, 3, 4],
y=[0, 1, 1.5, 2, 3],
mode='lines',
line=dict(color='black', width=2),
showlegend=False,
zorder=0
),
data_line
],
name=f"scale_{i}"
))
fig = go.Figure(
data=frames[0].data,
frames=frames
)
fig.update_layout(
title="Contour",
updatemenus=[{
"buttons": [
{"label": "play", "method": "animate", "args": [None, {"frame": {"duration": 500}, "fromcurrent": True}]},
{"label": "pause", "method": "animate", "args": [[None], {"mode": "immediate", "frame": {"duration": 0}}]}
],
"type": "buttons",
"showactive": True,
"x": 0.1,
"y": -0.1
}],
sliders=[{
"steps": [{"args": [[f.name]], "label": f"Step {i+1}", "method": "animate"} for i, f in enumerate(frames)],
"x": 0.1,
"len": 0.9
}],
width=500,
height=500
)
fig.show()
only include the go.Contour trace:
with additional traces:
- Ngôn ngữ chính
- Python
- Star
- 18.8k
- Fork
- 2.8k
- Merge trung bình
- 13 giờ 41 phút
- Pull request đã merge (30 ngày)
- 21
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của plotly/plotly.py
-
P3 size: 1 task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
P3 size: 1 task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug P1
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
feature P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
feature P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Tất cả issue của plotly/plotly.py
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
learningequality/ricecooker#747 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
run-llama/llama_index#23199 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
KhronosGroup/glTF-Blender-IO#2769 ·