plotly / plotly/plotly.py

make the `._has_subplots` method from `go.Figure` accessible

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

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

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

説明

In some cases, when writings callbacks that only update a subplot of a Figure, it is useful to know if the figure will accept an append_trace to a specific location, or if add_trace should be used instead.

I use this workaround (using a try/except isn't great):

    if fig._has_subplots():
        fig.append_trace(trace, 1, 1)
    else:
        _ = fig.add_trace(trace)

If I only use fig.append_trace(trace, 1, 1), I get Exception: In order to reference traces by row and column, you must first use plotly.tools.make_subplots to create the figure with a subplot grid.

If I only use fig.add_trace(trace), the layout gets messed up.

Could it be possible to make this method public?

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

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

はじめの一歩

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

調査の方向性

go.Figure の _has_subplots の実装と、append_trace、add_trace、make_subplots に関する公開 Figure API を調査します。既存の subplot の動作を維持しながら、呼び出し側が try/except による回避策に頼らず、行と列による trace 参照が有効かどうかを判定するための公開チェックを使用できるようになれば、作業は完了です。

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

評価

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

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

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