[Bug] Geom_smooth graphical error when converting from ggplot to plotly using ggplotly
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello,
I have a graphical issue which shows up when converting a ggplot2 plot with geom_smooth to a plotly plot:
as you can see in the plotly plot, an extra nonsensical confidence interval ribbon gets generated below the fitted lines.
When I lower the confidence interval from 0.95 to 0.80 the ribbon in correctly displayed:
However this is not the confidence interval I need.
I know it has something to do with plotly as this is my ggplot (with confidence interval 0.95) used to generate the first bugged image:
Here is the (anonymized) code used to generate the plot(s):
p16 <- ggplot(data= df, order = rownames(x)) +
geom_point(data= df,aes(x=x.ordered, y=(mean1), color=paste("Number = ", Number))) +
geom_point(data= df,aes(x=x.ordered, y=(mean2), color=paste("Number2 = ", Number))) +
geom_smooth(data = dfcopy, aes(x=x.ordered, y=mean2, color=Number, group=Number), method="loess", level=0.95) +
ylab("y") + scale_y_continuous(limits=c(0, 1)) + xlab(paste("x")) +
theme_bw() + theme(plot.title = element_text(hjust = -.5, face="bold"), axis.title.x = element_text(hjust = 1, size = 14, face="bold"), axis.text.x = element_text(angle = 90, hjust = 1), axis.title.y = element_text(size = 14, face="bold")) +
ggtitle("") + labs(color = "\n\nType of data point: " )
p16 <- p16 + scale_color_manual(values=c("#B24745FF", "#DF8F44FF","#00A1D5FF", "#6A6599FF", "#00A1D5FF", "#6A6599FF"))
gp16 <- ggplotly(p16, tooltip=c("text")) %>% layout(legend = list(orientation = "v",xanchor = "center", x = 1.2), title = list())
Unfortunately I can't provide data or the axes, I also removed the ggplot text variable due to anonymous data.
If someone might know a solution to this graphical error, it would be greatly appreciated.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
未指定任何 repository 文件或测试,报告者也无法提供数据或坐标轴。请从 ggplotly 转换路径入手,使用 level=0.95 创建一个可复现的 geom_smooth loess 图,并将其与 ggplot 输出进行比较。当不再生成额外的置信区间带,且转换后的图与源图匹配时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100