plotly / plotly/plotly.py

JupyterDash line shapes incorrect plotted

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

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

bug P3
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

Plotting lines in Plotly and JupyterDash gives a problem. I don't know if the issue is related to Plotly or JupyterDash, depending on which is the expected behaviour.

It did work in a previous version of Plotly.

Versions:

dash==1.17.0
jupyter-dash==0.3.1
plotly==4.12.0

import plotly.graph_objects as go
from dash.dependencies import Input, Output
from jupyter_dash import JupyterDash

from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import dash_table

x_data = [ 54135, 12346, 75492, 64135, 748612, 31548 ]

fig = go.Figure(go.Scatter(x=x_data, y=[1, 2, 3, 4, 5, 6]))
fig.update_xaxes(
        title_text='Segments',
        type='category'
)
fig.add_shape(
      dict(
        type="line",
        xref='x', yref='y',
        x0=x_data[4], x1=x_data[4],
        y0=0, y1=10,
      )
)
fig.show()

app = JupyterDash(__name__)

app.layout = html.Div([
    dcc.Graph(figure=fig)
])

app.run_server(host='0.0.0.0', port=8003)

But apparently, this gives different results in Plotly as it does in Dash.

Plotly
image

Dash
image

(The small part on the left is the zoomed-out result, because the vertical-line was plotted at 31548 (which is the class of the X_data, but Dash seems to regard is as an integer)
This only happened in the latest updates (I used to work with plotly=4.8.0 before this error)

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

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

はじめの一歩

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

調査の方向性

提供された Python の再現コードから始め、指定された Plotly、Dash、JupyterDash のバージョンを使って、fig.show() の出力と JupyterDash app.run_server() の出力を比較します。追加された shape に対してカテゴリカルな x 軸の値がどのように解釈されるかを追跡し、その後、その不一致が Plotly と JupyterDash のどちらに属するのかを判断します。両方の出力で垂直線が意図したカテゴリに揃えば完了です。

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

評価

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

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

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