plotly / plotly/plotly.py

Certain padding values cause plots to overtake all other subplots

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

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

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

説明

Related to #4124 there is a set of padding values that will produce strange behavior such that a single subplot takes over all others.

Some setup:

import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
line_x = np.arange(10)
line_y = line_x**2

What works:

n_subplots = 6

full_fig = make_subplots(
    rows=n_subplots,
    cols=1,
)

for row_idx in range(1, n_subplots+1):
    full_fig.add_trace(go.Scatter(
            x=line_x,
            y=line_y,
            showlegend=False,
        ), row=row_idx, col=1)

This produces 6 different subplots of the same line.

What doesn't work:

line_x = np.arange(10)
line_y = line_x**2

n_subplots = 8
padding_size = 0.1

row_heights = [0.1]*n_subplots

specs = []
for _ in range(n_subplots):
    specs.append([{'b': padding_size/2., 't': padding_size/2.}])

full_fig = make_subplots(
    rows=n_subplots,
    cols=1,
    row_heights=row_heights,
    specs=specs,
)

for row_idx in range(1, n_subplots+1):
    full_fig.add_trace(go.Scatter(
            x=line_x,
            y=line_y,
            showlegend=False,
        ), row=row_idx, col=1)

Adding the padding and row heights now generates only a single plot.

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

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

はじめの一歩

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

調査の方向性

まず、提供されている make_subplots の例を実行し、row_heights と specs padding を使って6行の場合と8行の場合を比較します。make_subplots が行の高さと上部/下部のパディングをどのように処理しているかを追跡し、その後、再現した設定で修正を検証します。8つすべてのサブプロットが、1つのサブプロットに占有されるのではなく、それぞれ個別にレンダリングされれば完了です。

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

評価

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

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

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