Rainer M Krug <rai...@krugs.de> writes: > Hi > > I have two suggestions which are liked to each other. They are based > on R code blocks, but the should be useful for other languages as well. > > I have a document in which I use :session for creating R graphs. These > look like: > > #+begin_src R :file Correlation_1.pdf :results graphics > IFN.mean <- load.IFN.mean() > grid <- load.grid.CASTANEA.average() > image(IFN.mean) > #+end_src > > Everything works fine, unless there is an error in one graph. > > In this case, the device remains open, which leaves open devices at > the end of the export of the document.
I experience the same problem. And would love to see that addressed. > > If the code block which should create the graph would be wrapped into > a try() block, so that it would look like the following: > > try( > { > pdf("./Correlation_1.pdf") > IFN.mean <- load.IFN.mean() > grid <- load.grid.CASTANEA.average() > image(IFN.mean) > } > ) > dev.off() > > The device would be closed even if an error occurred during the > execution of the code. > > But still, when exporting to pdf, the call to pdflatex fails as only > a empty pdf is available. So it becomes necessary to go through the > pdf log to identify the graphs which failed. > > In this case it would be useful, to have a placeholder grah in the > final pdf, so that one can see which graphs did not work. > > In addition, this could be used as placeholders (well - they are > placeholders) for to be created graphs, while the text has already > been written. > > So my second suggestion would be to include a placeholder image, which > would be used if the generation of the actual graph fails. It would be > great (but not necessary) if the actual error message would be in the > image. Such an place holder image would be great, indeed. Thanks for bringing this up! Regards, Andreas