pies and subplot not working as expected
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Based on this StackOverflow post, it seems pie charts are not working as I would expect with subplot. I will admit though that this is my first ever attempt at pie charts in Plotly. I did verify by inspecting DOM that both pies do exist in the examples below.
# devtools::install_github('ropensci/plotly")
library(plotly)
ds_r <- data.frame(labels1 = c("Baseline", "DTC", "Detailing", "Flex"),
values1 = c(63.5, 8.5, 20.6, 7.4))
ds_l <- data.frame(labels2 = c("Baseline"),
values2 = c(100))
p <- plot_ly(
ds_r, labels = ~labels1, values = ~values1, type = "pie",
showlegend = F
)
p2 <- plot_ly(
ds_l,labels = ~labels2, values = ~values2, type = "pie",
showlegend = F
)
subplot(p, p2, nrows = 1)

empty axes
# devtools::install_github('ropensci/plotly")
# an "empty" plotlyjs axis for layout
emptyAxis <- list(
title = "",
zeroline = FALSE,
showline = FALSE,
showticklabels = FALSE,
showgrid = FALSE
)
p <- plot_ly(
ds_r, labels = ~labels1, values = ~values1, type = "pie",
showlegend = F
) %>% layout(xaxis = emptyAxis, yaxis = emptyAxis)
p2 <- plot_ly(
ds_l,labels = ~labels2, values = ~values2, type = "pie",
showlegend = F
) %>% layout(xaxis = emptyAxis, yaxis = emptyAxis)
subplot(p, p2, nrows = 1)

贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先使用 plot_ly() 和 subplot() 运行两个可复现示例,分别测试带有和不带有空轴布局的情况。跟踪 subplot() 如何分配 pie traces 和坐标轴;当两个饼图无需空轴即可正确并排渲染时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100