plotly / plotly/plotly.R

Define fig size with subplot while height is deprecated in layout

未关闭
#1,613 3 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

When using height argument in layout, I have a warning telling that this argument is deprecated.
I can use height in plot_ly function directly which is very fine.

However, when using subplot, I did not find a convenient way to specify the total height for the assembled panels. Should subplot accept its own height and width arguments ?

If I understand correctly, subplot uses by default the layout from one of the contained plots. It seems to be the case for width and height but I find it confusing because:

  • height is encouraged to be defined outside of the layout function
  • it seems counterintuitive that the size of the panels assembly is controled by the size defined in one subpanel
panel1 = plot_ly(x = 1, y = rnorm(100), height = 600, width = 100) %>% 
           add_trace(type = "violin")
panel2 = plot_ly(x = 1, y = rnorm(100), height = 300, width = 300) %>% 
           add_trace(type = "violin")

# Size of individual panels are respected
panel1
panel2

# Total figure size uses size of one subpanel (one can use 'which_layout' to control which)
subplot(panel1, panel2)
subplot(panel2, panel1)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 subplot 和 plot_ly 入口点开始,然后检查 layout dimensions 和 which_layout 当前如何决定组装后 figure 的大小。在提出更改之前,明确 subplot 是否应独立于其 panel 接受 height 和 width,并定义 panel 尺寸冲突时的预期行为。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。