plotly / plotly/plotly.py

uirevision property doesn't keep the viewpoint consistent

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

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

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

説明

The following is the copy-paste of a question I opened on stackoverflow, it looks like to be a bug, so here i go:

I'm trying to keep the viewpoint consistent in my plotly-dash web app after every callback. This should be straightforward according to many already answered questions. The following line of code should do the magic:

fig.update_layout(uirevision='constant')

Unfortunately for me, it looks like that this is not the case for 3D scatter plots, here is a very brief piece of code that should allow to reproduce my problem:

import plotly.express as px
df = px.data.iris()

import dash
from dash import dcc
from dash import html
from dash import Input, Output

app = dash.Dash()
app.layout = html.Div([
    dcc.Dropdown(['option1', 'option2', 'option3'], 'axis', id='x-dropdown', clearable=False),
    dcc.Graph(id='main-plot')
])
@app.callback(
    Output('main-plot', 'figure'),
    Input('x-dropdown', 'value'))
def update_figure(x_selector):
    fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',  color='species')
    fig.update_layout(uirevision='constant')
    return fig
    
app.run_server(debug=True, use_reloader=False)

This is what i'm observing:
unexpected behavior

I can tell that the uirevision is doing something since the viewpoint is not completely reset after the callback, but it is still very imprecise. Is there something I'm missing or is this the expected behavior?

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

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

はじめの一歩

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

調査の方向性

まず、issue にある最小限の Python Dash 再現コードを実行し、ドロップダウンを変更した後の 3D 散布図を確認します。レイアウト設定 uirevision が callback 間の 3D ビューポイントにどのような影響を与えるかを調査します。callback 後もビューポイントが一貫して維持され、示されているプロットの動作を損なわなければ完了です。

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

評価

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

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

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