plotly / plotly/plotly.R

plotly::subplot with >= 3 rows/cols results in different sized plots for inner/boundary plots

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

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

主要言語
R
スター
2.7k
フォーク
641
PR マージ指標
30日以内にマージされた PR はありません

説明

As per title, when making a subplot with >= 3 rows or columns with a margin (default is 0.02 but the issue is easier to see with more plots/bigger margins)

library(magrittr)
p <- plotly::plot_ly(mtcars, x = ~cyl, y = ~mpg, color = ~rownames(.data), type = "bar") %>% plotly::layout(showlegend = FALSE)
plotly::subplot(p, p, p, p, p, p, p, p, p, nrows = 3, margin = 0.1)

image

There is a PR (#622) which aims to fix it, but the PR also does some extra things like make the margins fixed rather than scaled. I think it's possible to provide a much quicker & simpler fix as an alternative, given that this has been known about since 2016.

I think in a nutshell its due to the function get_domains & it's for loops:
https://github.com/plotly/plotly.R/blob/4bb1e44c5e27898bdf7ac45422564fa5200fb5f5/R/subplots.R#L385-L401
It's those if's that are the problem, can they be removed without causing too much trouble?

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

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

はじめの一歩

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

調査の方向性

R/subplots.R、特に get_domains と 385–401 行付近のループから始めてください。提供されている R の例を nrows = 3 および margin = 0.1 で実行し、その後、内部プロットと境界プロットのドメインサイズを比較してください。subplot パネルのサイズが一貫すれば完了です。続行する前に、関連する作業について PR #622 を確認してください。

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

評価

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

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

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