plotly / plotly/plotly.js

full_figure_for_development giving different margins in 6.3 than in 6.2

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

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

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

説明

I noticed that full_figure_for_development gives different margins in plotly.py 6.2 and 6.3, probably because of the plotly.js version bump from 3.0.1 to 3.1.0. Can this be considered a bug? In our use case, we read and use these values to update figure.layout.height, because we want to ensure a fixed height of the plot area.

Consider this plotly.py code:

import plotly.graph_objects as go

figure_dict = {
  "data": [
    {
      "x": ["A", "B", "C", "D"],
      "y": [100, 200, 150, 300],
      "type": "bar"
    }
  ],
  "layout": {
    "margin": {
      "b": 40,
      "l": 0,
      "r": 0,
      "t": 0
    },
    "yaxis": {
      "tickfont": {
        "size": 19
      },
      "ticklabelposition": "inside top",
      "ticklen": 10
    }
  }
}

figure = go.Figure(data=figure_dict["data"], layout=figure_dict["layout"])
fffd = figure.full_figure_for_development()

print(fffd.layout.computed["margin"])
Output for 6.2.0:

{'b': 105, 'l': 0, 'r': 0, 't': 4}

Output for 6.3.0:

{'b': 105, 'l': 0, 'r': 0, 't': 0}

With this second example, also margin.b differs:

import plotly.graph_objects as go

figure_dict = {
    "data": [
        {
            "x": [
                "A",
                "B",
                "C",
                "D"
            ],
            "y": [
                100,
                200,
                150,
                190
            ],
            "type": "bar"
        }
    ],
    "layout": {
        "yaxis": {
            "automargin": "height",
            "ticklabelposition": "inside top",
            "insiderange": [
                0,
                250
            ]
        },
        "autosize": True,
        "legend": {
            "orientation": "v",
            "x": 0.05,
            "y": -0.1,
            "yanchor": "top"
        },
        "margin": {
            "autoexpand": True,
            "b": 40,
            "l": 0,
            "r": 0,
            "t": 0
        },
        "showlegend": True
    }
}

figure = go.Figure(data=figure_dict["data"], layout=figure_dict["layout"])
fffd = figure.full_figure_for_development()

print(fffd.layout.computed["margin"])
Output for 6.2.0:

{'b': 70, 'l': 0, 'r': 0, 't': 17}

Output for 6.3.0:

{'b': 72, 'l': 0, 'r': 0, 't': 0}

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

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

はじめの一歩

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

調査の方向性

plotly.py の full_figure_for_development() を通じて、plotly.js 3.0.1 と 3.1.0 で両方の例を再現し、その後、計算されたマージン値がどのように生成されるかを調査する。バージョンに関連するマージンの差異が説明され、期待される動作が回帰チェックでカバーされていれば完了とする。

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

評価

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

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

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