0

I am trying to get extend my confidence interval to 13 on my x axis. I tried using coord_cartesian but it only expands towards the left (towards lower values of x).

I was doing a multiple regression using my dataset annualall with 3 variables (Tavtemp, Trainfall, Twindspeed) and was trying to plot the linear regression results separately for each variable.

Here is my code:

model_Tannual<-lm(Survival~Tavtemp+Trainfall+Twindspeed, data= 
 annualall)
 summary(model_Tannual)

ggplot(annualall,aes(x=Tavtemp, y=Survival))+ geom_point() + ylim(0,0.4)+
geom_smooth(method = "lm", se=TRUE,
fullrange=TRUE,size=0.5,colour="black")+scale_x_continuous(limits = c(10,13))+
xlab("Annual Average Temperature(°C)") +ylab ("Post-fledging Survival Rate")+
coord_cartesian(xlim = c(10,13))

My plot and dataset are in the link below. Thank you!

Plot
Dataset

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
Sammi
  • 1
  • 1
  • 1
    It's not really possible to help you with the information you have included here I'm afraid. We can't see your plot to know what it currently looks like, nor do we have your data to reproduce the plot ourselves or examine the variables to see where the problem is. Perhaps you could edit your question to show us your data (`dput(annualall)` might be helpful to reproduce your data) – Allan Cameron Feb 20 '22 at 22:38
  • Hi Allan, sorry I did add my plots and datasets but it just disappeared. I will try to fix it again thanks – Sammi Feb 20 '22 at 23:50
  • Including your data set in this format is not useful. Can you either cut-and-paste a text version *or* the output of `dput()` applied to your data (both in code format block) ? – Ben Bolker Feb 21 '22 at 00:20
  • Your problem is not with the x-range, but with the fact that the polygon drops below the range of your `ylim` and is censored: see the linked duplicate ... – Ben Bolker Feb 21 '22 at 00:22

0 Answers0