plotly / plotly/plotly.py

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

Đang mở
#1,753 3 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug P3
Ngôn ngữ chính
Python
Star
18.8k
Fork
2.8k
Merge trung bình
16 giờ 26 phút
Pull request đã merge (30 ngày)
21

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách chạy reproducer được cung cấp với các phiên bản Python, Jupyter và IPython đã liệt kê, so sánh đầu ra thông thường của fig.show() với display() của FigureWidget cho cả trường hợp độc lập và trường hợp subplot. Công việc được xem là hoàn thành khi các giá trị theta cực được hiển thị chính xác trong cả hai kịch bản FigureWidget; issue không nêu tên tệp mã nguồn hoặc test nào để bắt đầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
jupyter, jupyter-notebook, python
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.