From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Fraga, Eric" Subject: Re: ob-python.el: questions about output Date: Mon, 24 Feb 2020 13:42:08 +0000 Message-ID: <87sgj06r0y.fsf@ucl.ac.uk> References: <87eeuky4cn.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42800) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j6Dzw-0005e3-V7 for emacs-orgmode@gnu.org; Mon, 24 Feb 2020 08:42:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j6Dzv-0005Eu-Vk for emacs-orgmode@gnu.org; Mon, 24 Feb 2020 08:42:12 -0500 Received: from mail-am6eur05on2107.outbound.protection.outlook.com ([40.107.22.107]:31713 helo=EUR05-AM6-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j6Dzv-0005Eb-IU for emacs-orgmode@gnu.org; Mon, 24 Feb 2020 08:42:11 -0500 In-Reply-To: (R. C.'s message of "Mon, 24 Feb 2020 02:13:10 -0500") Content-Language: en-US List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: R C Cc: "emacs-orgmode@gnu.org" 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 only output the code for the main body. E.g. something along the lines of #+name: mainblock #+begin_src python :results file :noweb yes def f(x): return np.polyval(a, x) a =3D [1, -4, 4.5, -1.5] x =3D np.roots(a) print(f'Roots of the polynomial are {x}') x_ =3D np.linspace(np.min(x), np.max(x), 100) #+end_src #+name: full #+begin_src python :results file :noweb yes import numpy as np import matplotlib.pyplot as plt <> plt.plot(x_, f(x_)) plt.plot(x, f(x), marker=3D'o') plt.savefig('img/ex1.png') return 'img/ex1.png' #+end_src 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? --=20 : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880