Hi All, I have conducted a meta analysis using the metabin function. I want to plot 5 subgroups on the same forest plot. I have managed to do this using the byvar argument but when i plot the forest plot in R graphics I am unable to view the very top and very bottom of the image. It is as though the plot is too long. Is there a way in which I can ask R to show the entire plot within the boundaries of the window? Many Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Appearance-of-Forest-Plot-tp3075326p3075326.html Sent from the R help mailing list archive at Nabble.com.
Hi, Can you give a reproducible example of what you did? My intuition is that you could do it using par(), but I am not sure what package metabin() is from (certainly none of the ones that load by default), and I have even less idea how you created a forest plot (there are many ways in R). If you make up a little dataset (or use one of the built in ones) and then show your code using that example, we can replicate what you did and provide help. I would also say that for faceting or otherwise breaking up your data but having on graph, I find either the lattice or ggplot2 packages easier to work with than base graphics. Cheers, Josh ===================> and provide commented, minimal, self-contained, *reproducible code*. =================== On Mon, Dec 6, 2010 at 1:09 PM, steph306 <stephthurston at hotmail.com> wrote:> > Hi All, > > I have conducted a meta analysis using the metabin function. I want to plot > 5 subgroups on the same forest plot. I have managed to do this using the > byvar argument but when i plot the forest plot in R graphics I am unable to > view the very top and very bottom of the image. It is as though the plot is > too long. Is there a way in which I can ask R to show the entire plot within > the boundaries of the window? > > Many Thanks. > -- > View this message in context: http://r.789695.n4.nabble.com/Appearance-of-Forest-Plot-tp3075326p3075326.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
Hi Josh, Thank you for your response. I have recreated my issue using the Olkin 95 data and subgrouping by year of study - I hope it shows where my problem lies: library(meta) data(Olkin95) metaeg<-metabin(event.e, n.e, event.c, n.c, studlab = author, data=Olkin95, method="MH", sm="OR", MH.exact=FALSE, RR.cochrane=FALSE, comb.fixed=TRUE, comb.random=TRUE, title="", complab="", outclab="", label.e="Active", label.c="Control", print.CMH=FALSE, warn=FALSE) Olkin95$year<-Olkin95$year metaeg$year<-addvar(metaeg,Olkin95,"year",by.y="author") as.data.frame(metaeg) print.meta(metaeg) forest (metaeg,byvar=year) Any ideas would be very much appreciated. Thanks again! -- View this message in context: http://r.789695.n4.nabble.com/Appearance-of-Forest-Plot-tp3075326p3076271.html Sent from the R help mailing list archive at Nabble.com.
Hi, Thanks for the example! What about plotting it to pdf (or you can use your favorite file format, just switch png(), jpeg(), bmp(), tiff() for the pdf() call)? pdf(file = "temp.pdf", width = 14, height = 38) forest (metaeg,byvar=year) dev.off() I attached the PDF result so you could look at it. As far as I can tell, forest() does not mess with the par() settings too much, but slightly resizing things/fiddling with margins did not give me nearly what I would need to fit something that big on a screen. From a PDF or some graphics format though, it is easy to zoom in or out until the image fits. An alternative might be to break up the one big plot into 2-3 smaller ones. Cheers, Josh On Tue, Dec 7, 2010 at 4:31 AM, s306 <stephthurston at hotmail.com> wrote:> > Hi Josh, > > Thank you for your response. I have recreated my issue using the Olkin 95 > data and subgrouping by year of study - I hope it shows where my problem > lies: > > > library(meta) > > data(Olkin95) > > metaeg<-metabin(event.e, n.e, event.c, n.c, studlab = author, > data=Olkin95, method="MH", > sm="OR", MH.exact=FALSE, RR.cochrane=FALSE, comb.fixed=TRUE, > comb.random=TRUE, > title="", complab="", outclab="", > label.e="Active", label.c="Control", > print.CMH=FALSE, warn=FALSE) > > Olkin95$year<-Olkin95$year > metaeg$year<-addvar(metaeg,Olkin95,"year",by.y="author") > as.data.frame(metaeg) > > print.meta(metaeg) > forest (metaeg,byvar=year) > > Any ideas would be very much appreciated. Thanks again! > -- > View this message in context: http://r.789695.n4.nabble.com/Appearance-of-Forest-Plot-tp3075326p3076271.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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.-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ -------------- next part -------------- A non-text attachment was scrubbed... Name: temp.pdf Type: application/pdf Size: 112337 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101207/6a56df76/attachment.pdf>