Better support for trellis displays
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
There are a few different ways to do a trellis display currently, but these are all a bit esoteric
one_plot <- function(d) {
plot_ly(d, x = ~wt, y = ~mpg)
}
mtcars %>%
group_by(vs) %>%
do(plot = one_plot(.)) %>%
subplot(nrows = NROW(.))
plot_ly(mtcars, x = ~wt, y = ~mpg, color = ~factor(vs), yaxis = ~paste0("y", vs + 1)) %>%
subplot(nrows = 2)
plot_ly(mtcars, x = ~wt, y = ~mpg, split = ~factor(vs), yaxis = ~paste0("y", vs + 1)) %>%
subplot(nrows = 2)
#726 implements a trellis argument, which essentially maps that variable to sensible trace anchors, then uses subplot()'s machinery to populate axis objects. The problem is, we have guarantee a subplot is returned if we want a sensible result for:
plot_ly(mtcars, x = ~wt, y = ~mpg, trellis = ~vs)
Thus, we lose the ability to specify the number of rows in that subplot
It'd be better to have trellis() function:
trellis <- function(p, formula, ...) {
# do some stuff here
subplot(p, ...)
}
Ideally, the trellising would work a lot like ggplot2 facets (trellising variables should not appear in legends, and appear as annotations instead). This is what we do in ggplotly() via clever use of showlegend and legendgroup.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查 #726 中提出的 trellis 参数以及现有的 subplot() 机制。完整的解决方案应提供一个 trellis() 函数,在保留对 subplot 行的控制的同时支持类似 ggplot2 的行为,包括将 trellising 变量排除在图例之外并将其显示为注释。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100