plotly / plotly/plotly.R

Add more bar tests

未关闭
#967 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Just making a note so I don't forget -- add more tests for 71e29b4

# https://github.com/ropensci/plotly/issues/831
df <- data.frame(
  V1 = gl(6,20), V2 = gl(40,3)
)
p <- ggplot(df, aes(x = V1, fill = V2)) + geom_bar(color="white")
ggplotly(p)


# https://github.com/ropensci/plotly/issues/560
d <- data.frame(
  x = LETTERS[1:10], 
  y = -5:4, 
  g = rep(c('A','B'), each = 5)
)

p <- ggplot(data = d, aes(x = x, y = y, fill = g)) +
  geom_bar(stat='identity')
ggplotly(p)

# https://github.com/ropensci/plotly/issues/901
data_before <- data.frame(
  year = c(2014,2014,2014,2015,2015,2015,2016,2016,2016),
  pet = c("dog","cat","bird","dog","cat","bird","dog","cat","bird"),
  wt = c(56, 25, 26, 10, 19, 41, 16, 17, 13)
)
data_after <- data.frame(
  year = c(2014,2014,2014,2015,2015,2015,2016,2016,2016),
  pet = c("dog","cat","bird","dog","cat","bird","dog","cat","bird"),
  wt = c(49, 18, 19,  3, 12, 34,  9, 10,  6)
)
p <- ggplot() +
  geom_bar(data = data_before, aes(year, wt, fill = pet), 
           stat = "identity", position = "dodge", width = 0.9, alpha = 0.5) +
  geom_bar(data = data_after, aes(year, wt, fill = pet), 
           stat = "identity", position = "dodge", width = 0.9) +
  labs(x = "Year", y = "Weight") +
ggplotly(p)

# https://github.com/ropensci/plotly/issues/874
dd <- data.frame(x = rnorm(100,5,2))
dd2 <- data.frame(x = rnorm(100,5,2))
p3 <- ggplot() + 
  geom_histogram(data = dd,aes(x = x,y = ..count..)) + 
  geom_histogram(data = dd2,aes(x = x,y = -..count..),color = 'green')
ggplotly(p3)



# https://github.com/ropensci/plotly/issues/968

p <- ggplot(data=dat, aes(x=time, y=total_bill)) +
  geom_bar(stat="identity") + coord_flip()
ggplotly(p)

贡献指南

打开贡献指南

从这里开始

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

调研方向

没有指定测试文件或入口点。首先定位现有的 ggplotly 柱状图和直方图测试,然后查看与 issue 831、560、901、874 和 968 关联的复现示例;当每个案例都有回归测试覆盖,并记录了预期的图表行为时,即视为完成。

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

评估

技术栈
r
领域
data-visualization, testing
Issue 类型
重构
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
32/100

把新 issue 发到你的邮箱

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