[Feature request]: change height sizing policy of plotly htmlwidget to 100%
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Can we change the default widget height sizing policy set in as_widget to 100%. Right now it is 400px and this makes it hard to make a plot to fill its container along the height.
For example, I am hoping to use the following simplified example to change my plot to height 5in. It does not work (for me), because the style of the resulting htmlwidget is set to the default "400px"
tags$div(style="width: 100%; height: 5in",
plot_ly(x=1, y=1, type="scatter", mode="markers")
)
The following on the other hand does the job.
tags$div(style="width: 100%; height: 5in",
plot_ly(x=1, y=1, type="scatter", mode="markers") %T>% {
.$sizingPolicy$defaultHeight<-"100%"
}
)
It seems to me that a default height of "100%", like the default for width, makes more sense (allowing for the container to control the size) than the arbitrary "400px" used right now.
I really would like to control the height of my plots in a R markdown html document and this was the only solution I could come up with: R plotly seems to deal fine with "px" units, but setting inches and % did not work. Perhaps I am missing something...
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 as_widget 入口点开始,检查默认 sizingPolicy 的 height 是如何分配的。使用一个 5in 容器重现 tags$div 示例,然后验证当默认 height 为 100% 时,widget 会使用容器的高度。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 48/100