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.turl...@gmail.com> wrote: 





G'day Thomas,

On Sat, 12 Aug 2023 04:17:42 +0000 (UTC)
Thomas Subia via R-help <r-help@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

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to