subplot does not seem to handle well relatively long lists
还没有人认领这个 Issue。
- 主要语言
- 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))

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)

Any idea if there's hope to get all 28 bar plots without overflowing?
Thanks a lot
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从使用 28 个垂直堆叠柱状图的可复现 plotly::subplot 调用开始,然后将其与不会溢出的 19 个图情况进行比较。调查 subplot 如何处理长图列表中的 nrows 和共享 x 轴;完成标准是 28 个图都能在不溢出的情况下渲染,同时保留共享轴和图例。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100