plotly / plotly/plotly.py

Adding secondary-y latex legend name shifts x-axis coordinates

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

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

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

説明

Plotly version 5.20.0.

I am creating subplots with seconary y-axes. When I add the name attribute to a figure that includes a Latex string, the x-axis coordinates are incrementally shifted more and more to the right with each subplot. For instance, the first subplot in this image renders fine, but 2 through 4 are shifted right:

newplot (26)

This only happens when including the Latex string.

Here's a minimal working example:

import plotly.graph_objects as go
from plotly.subplots import make_subplots

x = [1, 2, 3, 4]
y = [1]*4

R = 1
C = 4

fig = make_subplots(
    rows=R,
    cols=C,
    specs=[
        [{"secondary_y": True} for _ in range(C)]
        for _ in range(R)
    ],
)

rc = [(r, c) for r in range(R) for c in range(C)]

for i, (r, c) in enumerate(rc):
    fig.add_trace(
        go.Scatter(
            x=x,
            y=y,
            showlegend=not i,
            name="y1",
        ),
        row=r+1,
        col=c+1,
        secondary_y=False,
    )
    fig.add_trace(
        go.Scatter(
            x=x,
            y=y,
            showlegend=not i,
            name=r"$y$2",
        ),
        row=r+1,
        col=c+1,
        secondary_y=False,
    )



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

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

はじめの一歩

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

調査の方向性

提供された4つのsubplotを持つ最小限の動作例を実行し、LaTeXの凡例名がある場合とない場合でレンダリングを比較してください。レンダリング中にsubplotのx軸座標がどのように計算されるかを追跡し、その後、セカンダリ軸のtraceがLaTeXラベルを使用する場合でも、すべてのsubplotの位置が揃ったままであることを確認してください。

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

評価

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

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

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