[R] geom_smooth
Thomas Subia
tg@77m @end|ng |rom y@hoo@com
Sun Aug 13 02:39:58 CEST 2023
Colleagues,
Your suggestions are elegant and greatly appreciated.
Thomas Subia
On Friday, August 11, 2023 at 11:08:42 PM PDT, Berwin A Turlach <berwin.turlach using gmail.com> wrote:
G'day Thomas,
On Sat, 12 Aug 2023 04:17:42 +0000 (UTC)
Thomas Subia via R-help <r-help using r-project.org> wrote:
> Here is my reproducible code for a graph using geom_smooth
The call "library(tidyverse)" was missing. :)
> 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.
This works for me:
ggplot(scatter_data,aes(x=x_var,y=y_var,))+
geom_point()+
geom_smooth(se=TRUE,fill="blue",color="black",linetype="dashed") +
geom_ribbon(stat="smooth", aes(ymin=after_stat(ymin), ymax=after_stat(ymax)), fill=NA, color="black")+
theme_cowplot()
Cheers,
Berwin
More information about the R-help
mailing list