-
Notifications
You must be signed in to change notification settings - Fork 636
Description
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.