How to add only significant regression lines

72 views
Skip to first unread message

Sara Boles

unread,
Sep 23, 2020, 1:28:43 PM9/23/20
to ggplot2
I am trying to add only significant regression lines for survival and larval lipid data. When I plot this code, the figure appears, but regression lines are not generated. Any suggestions in where I am going wrong in my code?  Any help is much appreciated.

Cheers,

Sara

```{r,fig.width=17,fig.height=7}
ggplot(abalone,aes(AvgLip7dpf,Perc74))+geom_point(aes(fill=Treatment,shape=Treatment),color="black",size=4)+geom_smooth(data=subset(abalone,Treats=="Ocean Acidification to Ocean Acidification 74 DPF 14 C Settlement Temperature 18 C Grow-Out Temperature" | Treats=="Control-pH to Control-pH 74 DPF 14 C Settlement Temperature 18 C Grow-Out Temperature" | Treats=="Control-pH to Control-pH 74 DPF 14 C Settlement Temperature 14 C Grow-Out Temperature" | Treats=="Control-pH to Ocean Acidification 74 DPF 11 C Settlement Temperature 18 C Grow-Out Temperature"),method="lm",size=2.5,se=FALSE)+scale_shape_manual(values=c(23,21,24,22))+scale_color_viridis(discrete = TRUE,option = "D")+scale_fill_viridis(discrete = TRUE)+theme_bw()+theme(legend.position = "bottom",legend.direction = "vertical")+theme(axis.title.x = element_text(size =15,color = "black"))+theme(axis.title.y = element_text(size = 15,color = "black"))+labs(x="Total Larval Lipid Concentrations 7 dpf (ng/Individual)")+ylab(expression("Survival (%)"))+theme(legend.text=element_text(size=15))+theme(legend.title=element_text(size=0,face="bold"))+facet_grid(.~time74*SettlementTemp*GrowOutTemp,labeller = as_labeller(c(`11 C Settlement Temperature`="11°C Settlement Temperature",`14 C Settlement Temperature`="14°C Settlement Temperature",`14 C Grow-Out Temperature`="14°C Grow-Out Temperature",`18 C Grow-Out Temperature`="18°C Grow-Out Temperature",`74 DPF`="74 dpf")))+theme(strip.text.x=element_text(size=15))+theme(axis.text.y =element_text(size=15,color = "black"))+theme(axis.text.x =element_text(size=15,color = "black"))```

Brandon Hurr

unread,
Sep 23, 2020, 3:27:22 PM9/23/20
to Sara Boles, ggplot2
Sara, 

Could you strip a few layers off of your plot and give us some data to work with?

See the reproducibility link below this message. 

B

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ggplot2/35cb6e3d-63cf-49a8-895e-e2406a017e24n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages