plotly / plotly/plotly.R

plot_ly boxplot showing wrong x-axis

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

还没有人认领这个 Issue。

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

描述

Suppose I have a list with three slots, but data for slots 2 and 3 are not yet available. When plotting a boxplot with just the first two slots, everything works as expected:

library(plotly)
y <- list("Group 1" = c(105,74,20), 
          "Group 2" = NA_real_, 
          "Group 3" = NA_real_)

boxplot <- plot_ly(type="box")

boxplot %>% 
  add_boxplot(x=y[[1]]) %>%
  add_boxplot(x=y[[2]])

image

But when trying to plot data for all three slots (where slots 2 and 3 don't have data), then the x-axis label is messed up and the data seems to be messed up as well. (I expected the boxplot to look exactly the same as the one above.)

boxplot %>% 
add_boxplot(x=y[[1]]) %>%
add_boxplot(x=y[[2]]) %>%
add_boxplot(x=y[[3]])

image

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先运行 issue 的 R 复现,使用 plot_ly(type="box") 以及连续的 add_boxplot(x=y[[...]] ) 调用,将两个 trace 与三个 trace 进行比较。跟踪 add_boxplot 如何处理 NA_real_ 输入和 x 轴类别分配。完成的标准是,与两个 slot 的示例相比,添加空 slot 不会改变显示的数据或 x 轴标签。

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

评估

技术栈
r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
50/100

把新 issue 发到你的邮箱

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