Subplot panel height not consistent
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
There doesn't seem to be a way to set the total figure size for subplot().
Individual panel height can be specified in the call to plot_ly and (as i understand it) that height is scaled with the number of panels to become the total figure size.
I tried using this by passing to each subplot the individual plotheight multiplied with the number of subplots (nrows) so the total height of the total figure would be plotheight * nrows.
It turns out the heights aren't strictly adhered too.
Comparing the total height of the first two panels you can clearly see the x axes are at different heights:

generate_subplot <- function(nrows, margin = NULL){
if(is.null(margin)) margin = c(0,0,0,0)
p <- plotly::plot_ly(mtcars,
x = ~cyl, y = ~mpg,
color = ~rownames(.data),
type = "bar",
height = 150 * nrows
) %>% plotly::layout(
showlegend = FALSE,
shapes = list(
list(
type = 'rect',
fillcolor = "gray",
line = list(color = "gray"),
opacity = 0.05,
x0 = 0, x1 = 1,
y0 = 0, y1 = 1,
xref = 'paper',
yref = 'paper'
)
)
)
plotly::subplot(
rep_len(list(p), nrows),
nrows = nrows,
margin = margin
)
}
generate_subplot(2)
generate_subplot(4)
generate_subplot(8)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供されている generate_subplot の例を 2、4、8 行で実行し、レンダリングされた図のパネルと x 軸の高さを比較します。subplot() が繰り返された plot_ly オブジェクトとその高さの値をどのように結合するかを追跡します。各パネルが要求された一貫した高さを持ち、図全体の高さが期待どおりにスケールすれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100