plotly / plotly/plotly.js

keep the range of xaxis1 when toggling traces

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

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

feature P3
主要言語
JavaScript
スター
18.3k
フォーク
2k
平均マージ
2日 12時間
マージ済み PR(30日)
28

説明

Problem:

The fig has two xaxises, when toggled trace2, the range of xaxis1 was changed.

Feature request:

How to keep the range of xaxis1 like xaxis2 when toggle trace2?

https://github.com/user-attachments/assets/cf3ac904-8ae4-4cfa-9783-193196c327df

Code:

import plotly.graph_objects as go

fig = go.Figure()

x1 = [0, 1, 2, 3, 4, 5]
x2 = [100, 200, 300, 400, 500, 600]

fig.add_trace(
    go.Scatter(
        x=x1,
        y=[7] * 6,
        visible=False,
    )
)
fig.add_trace(
    go.Bar(
        x=[0, 1, 2],
        y=[1, 2, 3],
    )
)
fig.add_trace(
    go.Bar(
        x=[3, 4, 5],
        y=[4, 5, 6],
    )
)

# data3
fig.add_trace(
    go.Scatter(
        x=x2,
        y=[8] * 6,
    )
)

# create xaxis2
fig.update_layout(
    xaxis2={
        "anchor": "y",
        "side": "top",
        "overlaying": "x",
    },
)
# Re-assign scatter traces to axes created above
fig.data[3].update(xaxis="x2")

fig.show()

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

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

はじめの一歩

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

調査の方向性

まず、付属のPlotlyの例を実行し、重なっているxaxis1とxaxis2の範囲を観察しながらトレースを切り替えます。トレースの切り替え中の範囲更新の動作を調査します。xaxis1が現在の範囲を維持し、xaxis2が引き続き示されているとおりに動作すれば完了です。

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

評価

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

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

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