From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id YITsGuPOYmZ+lwAAqHPOHw:P1 (envelope-from ) for ; Fri, 07 Jun 2024 11:12:03 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id YITsGuPOYmZ+lwAAqHPOHw (envelope-from ) for ; Fri, 07 Jun 2024 11:12:03 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=h0TakNxK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717751523; a=rsa-sha256; cv=none; b=krxS6f5DUBLP6m0lWh6c4f9Ab2Yl/XgCs+1EedyyD8/Qc/9VDSzYhXw0nWimXTV3H+Q02q MOHp3O28iDwHKP9l3lNVzFzDsTdHqBix8NuDXzyO+CouZ42xHLre1QyddZLvP+0z2BZRPq 71a+RJYaixOo4o3YJrR0DxpAwloiARRBvU62QN99uPvbsa3xGHPRLE5a3WNoq3dhADDSOS vmtxgZfcGrJOAQVq12aRpVCeOjWtY5Jc/qxbSx4Xxn7oh2T0z1MdJANR8Gr5ulRSIhp2DI gyFmlrTwl0WWIjPUeiukB9+Oc032w4BXAbtUIUcL5hHPg8VwoH7Euc4v5xxarw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=h0TakNxK; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717751523; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+ieOHpZkQNjxkANumd+qUMstCuWkhfpZ49wde34ZB/o=; b=oqi4Jdd4RfNZZOHBxqhd6xV8fwNwkuMBjxZy4vePbDX1I3kFuXfw/doGyHwdmis+/0MbxH vuilCPmhNCACL40W0Wzm8l5jJPvAWnMwkxvmPyagvld4gIUBRiIRnmFtigwofoqUFW798o Kx8v0PtCQzYGWKNNqVzUJbtEMCP0EqFUTuwtIQ7oV9WV1m5ZHJOhI8sxI3tcl7Oo+h5O5S D3r8s36cUbEBSDEDDwuKkrfa0VHaibSkOif502K7TNJfgQ2//LmKFcUS3i+py+sKrBb+sg JoTiLVseaYa2P14Gy0xEXGXkd2h9q1q07rVvu+JMe93ziqpTD0qJ3hyV/vAaCA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3DF196A44A for ; Fri, 7 Jun 2024 11:12:03 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFVcr-0003ea-TT; Fri, 07 Jun 2024 05:11:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sFVco-0003co-QM for emacs-orgmode@gnu.org; Fri, 07 Jun 2024 05:11:06 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sFVcm-0004Rb-R3 for emacs-orgmode@gnu.org; Fri, 07 Jun 2024 05:11:06 -0400 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a68b41ef3f6so193303066b.1 for ; Fri, 07 Jun 2024 02:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717751463; x=1718356263; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+ieOHpZkQNjxkANumd+qUMstCuWkhfpZ49wde34ZB/o=; b=h0TakNxKjZJ1LL/YZGkII1hED3n4RG9F5t4lU4OHax5kc1aW4iVnbNjRpngIvVn5Uc tJDrvB5dmcimpt8BJVxsOjwO6/AfLyOAn8MstxT0Bp0A1zsvWf6MGd8IafZSeUH42mFS wEIWm9yfQOiPohJqdKw7BhCWrVasgEKaxuCvMn7Z9fJKYx6y3UIdKg+Jg6PNzFoYG+DK 52a7G5hZ2Fsmec0Qw3YPLhRcGN/3HIEQwHn2GaeBhLCHsCCZy9hEgUOERabQV+zRg2ZU WiZBgpvygJhadYEyD4iczbrFJXmmXkBq7ClQeyma/KPQsF7D+IiCt5Ht4h03zH9HASPG mfBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717751463; x=1718356263; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+ieOHpZkQNjxkANumd+qUMstCuWkhfpZ49wde34ZB/o=; b=jrkAnYhEJ6J5QHSXCbEq/Ueli/vF9QtH6nPKefAn7TPW6hsePBUD+24XCwvzDrDwhl e2D1epaP6jWNUFJHPyeQLQ06r6gfRtRCkkgsLeOhuL9uDFbIlA2gUzZmueXF0Y2XYiQO tJ2qBwiI/frLW9yBN43cVEZWbFDaIRe6/dvWP80frmbQZYgiIo0hWRzQFiYn7xEgkMWk oDhfAxzz/YHz6Zoo7168PQ8kA9ggVO2nS0mmo7S4GBkBtHYI48K2VNU5vN5TLBFcvQP/ H7J28brbE1gC2QdMQgo9kV/ocuxs40Mh2YmHHPkYPT0PiMt2eyNjpYreLIz4THADXElV JUZA== X-Gm-Message-State: AOJu0YxnWhCpYdlNSSaURfNXze1My6K9cf6525cHaBumuiUYmhvXqw8w ZLuHvrZuVYCsNF14bsM++lsCv4hCDOGuaiE1s4oIx35y9KZoZ+Ix/LiPCl4xq2ID2kHUmacIStC AwadMdAuoaSyYhkYxOUzSMhs+CDraJw== X-Google-Smtp-Source: AGHT+IEIItLwS/puh4gDiuRaZZ1HWedD5mXu1cZzdSwqLEz6f3RBr5dQS5fIMOhHC/VfKIXBG8p7zPiTTMSkbJyuZ3k= X-Received: by 2002:a17:906:f9d7:b0:a6a:7e39:2a3c with SMTP id a640c23a62f3a-a6cdb200fc5mr108225466b.48.1717751463143; Fri, 07 Jun 2024 02:11:03 -0700 (PDT) MIME-Version: 1.0 References: <87a5jz5j88.fsf@localhost> In-Reply-To: <87a5jz5j88.fsf@localhost> From: Giuseppe Pagnoni Date: Fri, 7 Jun 2024 11:10:51 +0200 Message-ID: Subject: Re: Output of R code block: only text or plot but not both? And only one "result" can be output? To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000c5f0bb061a492d45" Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=gpagnoni@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 3DF196A44A X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -8.67 X-Spam-Score: -8.67 X-TUID: 6wUTya1I/Aqz --000000000000c5f0bb061a492d45 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry, I just sent you the reply that was meant for Berry's advice :-). Your suggestion also looks very useful, but somehow the png files do not get saved (in the current directory or elsewhere), and I actually do not get any error messages in the R buffer (I also tried to change the file type to jpeg). Any idea why? thanks again giuseppe On Wed, Jun 5, 2024 at 8:35=E2=80=AFPM Ihor Radchenko = wrote: > Giuseppe Pagnoni writes: > > > #+begin_src R :file example.png :results output graphics file > > x <- rnorm(100) > > print(mean(x)) > > hist(x) > > hist(x^2) > > #+end_src > > > > Here, only the last plot gets displayed. Is it not possible to display > > more than 1 plot? > > We currently do not have automatic way to do it, so that the resulting > plots are inserted as previewable file links. However, in addition to > the approach with several :session source blocks proposed by Berry, you > can do it by hand in R: > > #+begin_src R :results output raw drawer :dir ./ > x <- rnorm(100) > print(mean(x)) > png(file=3D"hist1.png") > hist(x) > png(file=3D"hist2.png") > hist(x^2) > print("[[./hist1.png]]") > print("[[./hist2.png]]") > #+end_src > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at > --=20 Giuseppe Pagnoni Dip. Scienze Biomediche, Metaboliche e Neuroscienze Sezione Fisiologia e Neuroscienze Univ. di Modena e Reggio Emilia Via Campi 287 I-41125 Modena, Italy Tel: +39-059-205-5742 Fax: +39-059-205-5363 --000000000000c5f0bb061a492d45 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Sorry, I just sent you the reply that was meant=C2=A0for B= erry's advice :-).=C2=A0 Your suggestion also looks very useful, but so= mehow the png files do not get saved (in the current directory or elsewhere= ), and I actually do not get any error messages in the R buffer (I also tri= ed to change the=C2=A0file type to jpeg).=C2=A0 Any idea why?

thanks again
giuseppe

On Wed, Jun 5, 2024 at 8:35=E2= =80=AFPM Ihor Radchenko <yantar92= @posteo.net> wrote:
Giuseppe Pagnoni <gpagnoni@gmail.com> writes:

> #+begin_src R :file example.png :results output graphics file
>=C2=A0 =C2=A0x <- rnorm(100)
>=C2=A0 =C2=A0print(mean(x))
>=C2=A0 =C2=A0hist(x)
>=C2=A0 =C2=A0hist(x^2)
> #+end_src
>
> Here, only the last plot gets displayed.=C2=A0 Is it not possible to d= isplay
> more than 1 plot?

We currently do not have automatic way to do it, so that the resulting
plots are inserted as previewable file links.=C2=A0 However, in addition to=
the approach with several :session source blocks proposed by Berry, you
can do it by hand in R:

#+begin_src R :results output raw drawer :dir ./
=C2=A0 x <- rnorm(100)
=C2=A0 print(mean(x))
=C2=A0 png(file=3D"hist1.png")
=C2=A0 hist(x)
=C2=A0 png(file=3D"hist2.png")
=C2=A0 hist(x^2)
=C2=A0 print("[[./hist1.png]]")
=C2=A0 print("[[./hist2.png]]")
#+end_src

--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,=
or support my work at <https://liberapay.com/yantar92>


--
Gi= useppe Pagnoni
Dip. Scienze Biomediche, Metaboliche e Neuroscienze
Se= zione Fisiologia e Neuroscienze
Univ. di Modena e Reggio Emilia
Via C= ampi 287
I-41125 Modena, Italy
Tel: +39-059-205-5742
Fax: +39-059-= 205-5363

--000000000000c5f0bb061a492d45--