plotly / plotly/plotly.R

subplot does not seem to handle well relatively long lists

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

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

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

説明

Hi,

I'm trying to use subplot in order to vertically group bar plots, sharing their x-axis.

Here are example data which have 28 groups where I'm creating a bar plot over 4 families in each and then trying to vertically combine them using subplot:

set.seed(1)
df <- data.frame(group = paste0("G",unlist(lapply(1:28,function(i) rep(i,4)))),
                 family = paste0("F",rep(1:4,28)),
                 log2n = log2(as.integer(runif(4*28,0,30))+1),
                 stringsAsFactors = F)

Creating the list of bar plots:

library(plotly)
groups <- unique(df$group)
y.range <- c(0,max(df$log2n))
plot.list <- lapply(1:length(groups),function(g){
  group.df <- dplyr::filter(df,group == groups[g])
  plot_ly(x=group.df$family,y=group.df$log2n,type='bar',name=group.df$family,color=group.df$family,showlegend=(g==length(groups))) %>%
    layout(yaxis=list(range=y.range))
})

If I try:
p <- plotly::subplot(plot.list,shareX=T,nrows=length(plot.list))

Screen Shot 2019-04-10 at 6 48 53 PM

So it seems like some sort of an overflow.

I gradually cut down on the number of plots in plot.list that I run subplot on and when reach 19 it seemed to stop 'overflowing':
p <- plotly::subplot(plot.list[1:19],shareX=T,nrows=19)
Screen Shot 2019-04-10 at 6 50 37 PM

Any idea if there's hope to get all 28 bar plots without overflowing?

Thanks a lot

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

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

はじめの一歩

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

調査の方向性

28 個の縦方向に積み重ねた棒グラフを使用する、再現可能な plotly::subplot の呼び出しから始め、その後、オーバーフローしない 19 個のプロットの場合と比較します。長いプロットリストに対して subplot が nrows と共有 x 軸をどのように扱うかを調査します。完了条件は、共有軸と凡例を維持したまま、28 個すべてのプロットがオーバーフローなしでレンダリングされることです。

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

評価

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

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

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