subplot() doesn't account for dual axes
未关闭
还没有人认领这个 Issue。
difficulty: high
priority: low
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
I think there is something wrong with the subplot function when there is yaxis2
I tried to use subplot with 2 plots that have yaxis2. Each plot looks like this:

foo_plot <- function(n) {
x <- rnorm(n)
den <- density(x)
p <- plot_ly()
p <- add_trace(p, x=x, type="histogram", name="Histogram",
marker=list(line=list(color="#000", width=1), color="#555"))
p <- add_trace(p, x=den$x, y=den$y, yaxis="y2", name="Density",
type="scatter", mode="lines", line=list(color="#222"))
p <- layout(p,
yaxis2=list(overlaying="y", side="right", rangemode="nonnegative",
showgrid=F, showline=T, ticks="outside"),
yaxis=list(showline=T, ticks="outside"))
return(p)
}
p <- subplot(foo_plot(1000), foo_plot(1000), nrows=2, shareX=F, shareY=F)
The density curves were missing when I merge the two plots.

This is the result of sessionInfo()

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行 issue 的 foo_plot 和 subplot 示例,将每个绘图与合并后的两行结果进行比较。跟踪 subplot 对 yaxis2 的处理,并验证合并后两条密度曲线仍然可见;完成标准是双轴轨迹在合并后的绘图中能够正确渲染。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100