[R] geom_smooth

Thomas Subia tg@77m @end|ng |rom y@hoo@com
Sat Aug 12 06:17:42 CEST 2023


Colleagues,

Here is my reproducible code for a graph using geom_smooth
set.seed(55)
scatter_data <- tibble(x_var = runif(100, min = 0, max = 25)
                       ,y_var = log2(x_var) + rnorm(100))

library(ggplot2)
library(cowplot)

ggplot(scatter_data,aes(x=x_var,y=y_var))+
  geom_point()+
  geom_smooth(se=TRUE,fill="blue",color="black",linetype="dashed")+
  theme_cowplot()

I'd like to add a black boundary around the shaded area. I suspect this can be done with geom_ribbon but I cannot figure this out. Some advice would be welcome.

Thanks!

Thomas Subia



More information about the R-help mailing list