On 12-11-23 08:47 AM, Andrew Halford wrote:
> Hi All,
>
> I worked out that the use of the generic x and y remains for the call to
> the model. I have another query moving forward
>
> I am trying to replicate a nice graph that I saw on the website "stack
> overflow".
>
> I have managed to plot the scatterplot as I want and have overlayed the
> 2nd order polynomial line but there is no 95% CI. How do I get those on
> the plot?
>
> > p <- ggplot (soi.currents.edited,aes(SOI,u_average))
> > p <- p + geom_point(alpha=2/10, shape=21, fill="blue",
> colour="black", size=5)
>> p <-
> p+geom_smooth(method='lm',se=TRUE,fill=NA,formula=y~poly(x,2,raw=TRUE),colour='red')
>
> thanks
>
> Andy
By setting fill=NA you have turned off the plotting of the confidence
intervals ... try
geom_smooth(method='lm',formula=y~poly(x,2),colour='red')
(se=TRUE is the default anyway, and there's not need to go out of your
way to use a raw polynomial -- the predictions will be the same)
Ben Bolker
> Ph:
+61 (0) 468 419 473 <tel:%2B61%20%280%29%20468%20419%20473>
>
>
>
>
> --
> Andrew Halford Ph.D
> Adjunct Research Scientist
> University of Guam & Curtin University
> Ph:
+61 (0) 468 419 473
>
> --