plotly / plotly/plotly.py

Polar and polar subplot (make_subplots) not displaying correctly in FigureWidget Jupyter Ipython notebook

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

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

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
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

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

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

はじめの一歩

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

調査の方向性

まず、提供された再現プログラムを、記載されている Python、Jupyter、IPython のバージョンで実行し、単独の場合とサブプロットの場合の両方について、通常の fig.show() の出力と FigureWidget の display() を比較します。両方の FigureWidget のシナリオで polar の theta 値が正しく描画されれば完了です。この issue には、最初に取りかかるべきソースファイルやテストは記載されていません。

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

評価

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

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

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