plotly / plotly/plotly.R

ggplotly() bar chart render issue

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

还没有人认领这个 Issue。

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

描述

ggplotly() renders a layered bar chart incorrectly; results in stacked bars, see the figures. Any way to remedy? Thanks, Kimmo

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)
)

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)+
  xlab("Year") +
  ylab("Weight")

ggplotly()

ggplot chart (correct):
rplot

ggplotly() render (incorrect)
ggplotly

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先运行提供的 R 复现代码并比较 ggplot 和 ggplotly 图形,重点关注使用 position="dodge" 的两个分层 geom_bar 调用。跟踪此图表的转换和渲染过程,然后验证 ggplotly 结果是否保留了源图表中显示的分离 dodge 柱形和透明度。

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

评估

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

把新 issue 发到你的邮箱

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