Reputation: 99428
Some functions can draw a plot for each of multiple data. So it looks like a movie with many plots shown one after another very quickly. Examples of such functions including plot
and gelman.plot
of the output returned by BRugsFit()
, when there are many parameters and each plot for each parameter.
Because it flashes too fast, I want to examine each plot carefully before looking at the next plot. So I would like to save the plots into files, (if not possible, I would hope to slow down the flashing or at least have some control).
To save the plots, I try to put them into a single figure, but I haven't figured out how to do that successfully (note that I run R in bash terminal, not using any IDE such as RStudio):
> pdf('gelman.pdf')
> par(mfrow=c(10,10)); gelman.plot(output,auto.layout=F,autoburnin=F)
Error in plot.new() : figure margins too large
> dev.off()
null device
1
>
> pdf('tracedensity.pdf')
> par(mfrow=c(10,14)); plot(output,auto.layout=F)
Error in plot.new() : figure margins too large
> dev.off()
null device
1
Thanks!
Upvotes: 3
Views: 1299
Reputation: 2414
Get rid of the par
- which means you're trying to fit all the graphs on one page, but the error about figure margins means R isn't able to fit them on the same page so is producing no output. The remaining code will produce a multi-page pdf, one chart per page.
Alternatively, if you must have them on the same page, then use a larger page pdf('gelman.pdf', height=70, width=70)
should do it.
Upvotes: 3