Saving a plot in R from forest.robu function that does not fit plot window

Viewed 30

Using the forest.robu function from the robumeta package. Trying pdf(filename="test.pdf",width=20,height=8) suggested here did result in the error "unused argument filename". Any idea how I could make a plot from this function that does not fit the plot window fit in an output file? Thank you! output plot image

1 Answers

I'm guessing that you don't yet understand how R graphics devices are used. One needs to set a particular output device up and then print to it with one of the three graphics paradigms and then execute dev.off() to finish the process. Failing to execute dev.off() with ps or pdf or png will start a file but then it doesn't get finish and will be unreadable. I'm guessing that forest.robu constructs an object using either ggplot or lattice function calls, so do this:

?pdf; ?Devices; ?pdf.options  # the help pages have further useful links 

pdf(file= "My_grph.pdf", width=20, height=8)
gobj <- forest.robu( ..... whatever ...)
print(gobj)
dev.off()

If on the other hand, forest.robu() uses base-graphics plotting, then the print call is unneeded and might even cause problems so leave it out.

Related