[R-meta] Forest plot size bounds

Michael Dewey ||@t@ @end|ng |rom dewey@myzen@co@uk
Thu Jul 30 10:16:51 CEST 2020


Dear Erika

Welcome to one of life's great challenges, tuning graphics in R. In this 
case I think you need to adjust the ylim parameter to forest(). If you 
store the result of forest and then print it you will see the defaults 
it chose and you can then engage in a process of trial and error to get 
the spacing you need.

Michael

On 30/07/2020 01:01, Erika Zavaleta wrote:
> Hi everyone,
> 
> I am trying to make a forest plot of my data and cases, and I need help 
> figuring out how to remove the horizontal line at the top of the figure 
> that appears above the cases/ below the header. The problem is that I 
> have a large number of cases. With breaks included to accommodate 
> subgroup means, subgroup headers and the grand mean, that horizontal 
> line ends up falling within the rows of cases rather than above them:
> 
> 
> 
> It appears there is a limit on how many rows will fit below it. How can 
> I eliminate that line? My code is here if useful:
> 
> library(metafor)
> forest(fullmamm2$yi,fullmamm2$vi, cex=0.55, cex.axis=0.8,xlab="Annual 
> change in migrating fraction", cex.lab=0.8, 
> slab=paste(fullmamm2$comname), annotate=FALSE, rows=c(1:52,55:59), 
> header=FALSE)
> res<-rma.mv(yi, vi, mods=~factor(class), random=~1|comname, data=fullmamm2)
> preds <- predict(res)
> addpoly(preds$pred, sei = preds$se,  mlab = "", col="gray66", 
> cex=0.8,annotate=FALSE)
> 
> ###fit model in the two subgroups
> res.m <- rma(yi, vi, subset=(class=="Mammals"), random=~1|comname, 
> data=fullmamm2)
> res.b <- rma(yi, vi, subset=(class=="Birds"), random=~1|comname, 
> data=fullmamm2)
> 
> ### add summary polygons by group
> addpoly(res.m, row=54, cex=0.6, atransf=exp, mlab="", annotate=FALSE)
> addpoly(res.b, row= 0, cex=0.6, atransf=exp, mlab="", annotate=FALSE)
> 
> ###Add text for subgroups
> text(10,54, cex=0.7, c("MAMMALS"))
> text(10,0, cex=0.7, c("BIRDS"))
> text(10,-1, cex=0.7, font=2, c("GRAND MEAN"))
> 
> Thanks.
> 
> Erika
> 
> I stand with Black Lives Matter.
> 
> Erika Zavaleta
> Howard Hughes Medical Institute Professor
> Ecology and Evolutionary Biology Department
> University of California
> 130 McAllister Way
> Santa Cruz, CA 95060
> Faculty Director,
> Doris <https://conservationscholars.ucsc.edu>Duke Conservation Scholars 
> Program <https://conservationscholars.ucsc.edu> | Center to Advance 
> Mentored, Inquiry-based Opportunities (CAMINO) 
> <http://camino.ucsc.edu/> | Conservation Science and Solutions Lab 
> <http://zavaleta.eeb.ucsc.edu>
> 
> “Darkness cannot drive out darkness; only light can do that. Hate cannot 
> drive out hate; only love can do that.”
> Rev. Dr. Martin Luther King, Jr.
> 
> 
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
> 	Virus-free. www.avg.com 
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> 
> 
> 
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> 
> _______________________________________________
> R-sig-meta-analysis mailing list
> R-sig-meta-analysis using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
> 

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-sig-meta-analysis mailing list