Ihor Radchenko <yanta...@posteo.net> writes: > Liu Hui <liuhui1...@gmail.com> writes: > >> This patch adds graphics output support for ob-python via matplotlib. >> Specifically, it allows to use header argument `:results file >> graphics' as follows: >> >> #+begin_src python :file "test.png" :results graphics file >> import matplotlib.pyplot as plt >> plt.plot([1,2,3,4,5]) >> #+end_src > > This might be a useful feature, but it will break the existing > conventions, if used as in the patch. Currently, the above combination > of :file and :results is treated as the following:
":results graphics file" is used this way in ob-R and ob-julia, and also in the testing files test-ob-octave.el and ob-maxima-test.org. ":results graphics" just means that the result from org-babel-execute:lang isn't written to the file by org-babel-execute-src-block. This is needed for plotting because org-babel-execute:lang usually writes directly to the file, rather than returning a byte stream for the PNG or SVG. So the Org manual's wording about "side-effects" and "output not written to disk" is correct in a sense, but also confusing (readers should not have to know about these internal implementation details).