Re: ob-python.el: questions about output

2020-02-27 Thread R C
Hi Jack, Thanks for your suggestion to use ob-jupyter. That gives me the stdout and graphical output in separate results blocks as I wanted, and no return statement is needed. I don't know if there are any side-effects to using multiple sessions in a single org file, but so far it seems to work qui

Re: ob-python.el: questions about output

2020-02-24 Thread Fraga, Eric
On Monday, 24 Feb 2020 at 08:18, Jack Kamm wrote: > This sounds interesting. Do you know of any documentation or examples > for :prologue and :epilogue? I checked the Worg page for ob-maxima, but > it didn't mention these header arguments. I don't know of any documentation. They basically simply

Re: ob-python.el: questions about output

2020-02-24 Thread Fraga, Eric
On Monday, 24 Feb 2020 at 08:17, Jack Kamm wrote: > 1. noweb (as Eric mentioned). Then you only need to write the code > once, but note that it will be executed twice. Doesn't need to execute twice: maybe add ":eval no" to the first block, the one that will be included in the other one? -- : Eri

Re: ob-python.el: questions about output

2020-02-24 Thread Jack Kamm
Hi Eric, "Fraga, Eric" writes: > Longer term, better would be an implementation of :prologue and > :epilogue options for python src blocks like we have for Maxima. It > would probably make sense to provide these options for most if not all > src blocks? This sounds interesting. Do you know of

Re: ob-python.el: questions about output

2020-02-24 Thread Jack Kamm
Hi RC, R C writes: > My python src blocks often have both graphical output as well as the > results of some numerical calculation displayed using print statements. > > When exported I would like the line: return 'img/ex1.png' not to be > included in the listing of the src block. > > Also, the ou

Re: ob-python.el: questions about output

2020-02-24 Thread Fraga, Eric
On Monday, 24 Feb 2020 at 02:13, R C wrote: > When exported I would like the line: return 'img/ex1.png' not to be > included in the listing of the src block. I don't think this is currently possible in the sense you want. You could use :noweb where you have one src block referring to others and o

Re: ob-python.el: questions about output

2020-02-24 Thread R C
Hi Jack, Thanks for your response. Sorry for not being clearer. My python src blocks often have both graphical output as well as the results of some numerical calculation displayed using print statements. #+begin_src python :results file import numpy as np import matplotlib.pyplot as plt def f(x):

Re: ob-python.el: questions about output

2020-02-23 Thread Jack Kamm
Sorry, my email had a typo: > #+begin_src python :session session1 :results output > x > #+end_src That should be ":results value".

Re: ob-python.el: questions about output

2020-02-23 Thread Jack Kamm
Hi RC, R C writes: > 1. Is it possible to have both types of output displayed from a single src > block to avoid having to duplicate the src block, using :exports results > for one and :exports both for the other? No, there's no option to output both ":results output" and ":results value". If

ob-python.el: questions about output

2020-02-23 Thread R C
The approach proposed for graphical output at https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html is #+begin_src python :results file import matplotlib, numpy matplotlib.use('Agg') import matplotlib.pyplot as plt fig=plt.figure(figsize=(4,2)) x=numpy.linspace(-15,15) plt.