Polar and polar subplot (make_subplots) not displaying correctly in FigureWidget Jupyter Ipython notebook
未关闭
还没有人认领这个 Issue。
bug
P3
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 16 小时 26 分钟
- 30 天内合并 PR
- 21
描述
plotly==4.1.1
jupyter==1.0.0
ipython==7.8.0
Plotting a polar in a subplot works fine (#758 resolved in 4.1.1?) but wrapping a polar figure in a FigureWidget and using display causes theta values to become very strange, scattering the data. This happens for subplots and solo polar plots.
This would appear to be a Bug. Any thoughts on a workaround?
import plotly
import plotly.graph_objs as go
import numpy as np
from plotly.subplots import make_subplots
# Data
# the first subplot: a histogram (If using)
trace1 = go.Histogram(
x=np.random.uniform(1,6,size=62),
)
# the second subplot: a polar graph
trace2 = go.Scatterpolar(
r = np.random.uniform(1,6,size=62),
theta = np.random.uniform(30,5,size=62),
mode='markers',
)
# # # # # # # # # # # # # # # # # #
# single polar example
# # # # # # # # # # # # # # # # # #
fig = go.Figure(
trace2,
layout=go.Layout(
title=go.layout.Title(text="Polar chart - normal fig.show()")
)
)
fig.show()
# Now wrap in a figure widget and use same traces
# not working correctly
fig.update_layout(go.Layout(
title=go.layout.Title(text="Polar chart - FigureWidget")
)
)
fig2 = go.FigureWidget(
fig,
)
display(fig2) # allows traces to be added but displays wrong
print("FigureWidget.show()")
fig2.show() # This will not be updateable with data - just shows base fig
# # # # # # # # # # # # # # # # # #
# Subplots example
# # # # # # # # # # # # # # # # # #
# normal use of make_subplots
# make 2 plots sublplot
fig = make_subplots(rows=1, cols=2, specs=[[{}, {'type': 'polar'}]],)
fig.update_layout(go.Layout(
title=go.layout.Title(text="Polar chart - normal fig.show()")
))
fig.append_trace(trace1, 1, 1)
fig.append_trace(trace2, 1, 2)
fig.show()
# Now wrap in a figure widget and use same traces
# not working correctly
fig2 = go.FigureWidget(make_subplots(rows=1, cols=2, specs=[[{'type': 'bar'}, {'type': 'polar'}]]))
fig2.update_layout(go.Layout(
title=go.layout.Title(text="Polar chart - FigureWidget")
))
display(fig2) # allows traces to be added but the polar one displays wrong
print("FigureWidget.show()")
fig2.show() # This will not be updateable with data - just shows base fig
# the first subplot: a histogram
fig2.append_trace(trace1, 1, 1)
# the second subplot: a polar graph
fig2.append_trace(trace2, 1, 2)
print("FigureWidget.show()")
fig2.show() # This fig show will work and display correct data
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用列出的 Python、Jupyter 和 IPython 版本运行所提供的复现程序,并比较独立情况和子图情况下正常的 fig.show() 输出与 FigureWidget 的 display() 输出。当两个 FigureWidget 场景中的极坐标 theta 值都能正确渲染时,即视为完成;该 issue 一开始没有指定源文件或测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- jupyter, jupyter-notebook, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100