emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ob-python: support header argument `:results file graphics'


From: Jack Kamm
Subject: Re: [PATCH] ob-python: support header argument `:results file graphics'
Date: Tue, 04 Jul 2023 21:55:14 -0700

Ihor Radchenko <yantar92@posteo.net> writes:

> Liu Hui <liuhui1610@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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]