From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:1008:1e59::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id IKtwCqXVYmYJNAEAA41jLg (envelope-from ) for ; Fri, 07 Jun 2024 11:40:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 4PscB6XVYmb6JgAA62LTzQ (envelope-from ) for ; Fri, 07 Jun 2024 11:40:53 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Q1TfWf36; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1717753253; 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=P5K7ydqkw0hOAgpMGB+tHylkk7N13B9vbTPsLIL0FDE=; b=TMhTbXGU8QMoUl/F5VyZL4iZgnrh58dOfT2AfJWbxNjowoUhvx8yvMqdetwZrckjBFOCPC AP5l2aa2KOdqSShMhKCP+0KCuT/JSOCdkExfs/sQ2AskshCvPpgknt8E/MspAu6meNfPZe hJahFUWWwu71IJo4ohCtU1SpLUK9f7u7OtF18xS4KMZnDhmTDFLdgqym07KA1VZrCbT5kl M+T+GF3bazt592+VNX880vXYTBlmoQseoOk7RcnSDzkSgY8jpTruWxcDJ7qPOT+/EExkgV U841MSeaVaIW//YMfqMlmjbRA2Sq5jVo5A9Kz/G/gVjZn2bT+UP+rICX64SkHA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Q1TfWf36; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1717753253; a=rsa-sha256; cv=none; b=hTf+eX7URzAi7IIpHrPnWgfeBTSWr1F2WjLYtuL4ln13ZSSaC6D8L9d2cRT1V5S+kS691w O3aO/8qmbKM6O1j9vYS/MOYLFi0yT6VfbHSjP/IxlHV9sOyHtea0lxmOobsEcMb05DAdsf N1iyADYFqnLYSuaXeRKjv6hYmEMkpjMwC/VviEzSkrJ9vE5eXE5xikDRzWn0yWnlSSvlzg KyWmwEUgCu2qabgPRBzDvJJf1T0JkCr0hmoPNNpFlFiQNPCS+fr/p6Py1rsRQLYu5qEb42 3tHCgbCD0WtxjfmsIf7CCZWNsBsUlxJQRIxjgkqxFeUw3zW9PFCDc5j+HCX6hA== 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 E1A606038E for ; Fri, 7 Jun 2024 11:40:52 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFW4o-0006jG-Gi; Fri, 07 Jun 2024 05:40:02 -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 1sFW4n-0006ix-DI for emacs-orgmode@gnu.org; Fri, 07 Jun 2024 05:40:01 -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 1sFW4l-0000cD-BR for emacs-orgmode@gnu.org; Fri, 07 Jun 2024 05:40:01 -0400 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a6269885572so534541766b.1 for ; Fri, 07 Jun 2024 02:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717753198; x=1718357998; 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=P5K7ydqkw0hOAgpMGB+tHylkk7N13B9vbTPsLIL0FDE=; b=Q1TfWf36bNZU3CtXPrQUXhile3u2Opyunb6coFuxaCXYvz79L0dH169l/zo9KX0/Qz pDS6hAx2RO17xVEeYWrOljKAM8mGlUEad0BsZqxqzZg1GsL1eYY4gRX3V83WVnngRjA/ CyTvks8OKD4POCs9mT7N12RlEpbzfLgYSmQ+0zKpUoHkIqWIFEt1Brzpn7N4gEq5PWBW uOl6DSTve41sbTczD1lPi77CsKq8OvqDer9C/kWpjRmnjI3A32mTrbpTzG9BnpWEYtv1 t5j/DXlvGO3pXvfmfglr+2UAh5EtQcXiWgwv+GNoonLryfmFY3j3b3MJLYn0VNI93iYY 7d4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717753198; x=1718357998; 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=P5K7ydqkw0hOAgpMGB+tHylkk7N13B9vbTPsLIL0FDE=; b=Vf0zMoqx5cr/Altkj7aa0kqNv4+kP3YjJWVJ6MvbxVTeB3ShEMRo+AVuSzqUKxB4WJ o9PvKVE8rzZxQxlTRsCFhVGuyQpS5fLlH6NczWISH8cCJdyEIFUGy5F0+xAxhMdFAKYC 6JQMfr8ctxqwhkVUdja3Lyzmxk19VtbNYLKKtPbj/cD5NHt2FKSPnm2UBhM8AJLSD2f4 njOrospBs8qA/jRO+gN9M2oq0O+ya/Esy505lfrHYqBmWdWUurD5TL7sKd+TJjJ0ojXs ahIhO77IgaI7Y3O/a0DGDXoXIBK29XyjmYnjZXvlQlyi0bTrfJJ+ITeoCBKYu/svuEl4 JuwQ== X-Gm-Message-State: AOJu0YzXRMd7CMet54P0k69qXqQPvhrr+TGn4+BtfldizIhIf24U1DGY TwW4iQMxLXJMyVJPNI0spK4xQXlVUmSPMT5eDBSpxOcS0j2yDAxIEQZUzKNtbPTr08Nr4JkNllv UsnRAgYclTg80a0mhM0vOSLsHxHHx/aZO X-Google-Smtp-Source: AGHT+IG76mHLt/6g7tx8SylicoS6lFFaJ3Ikm8gf3wlqWGEpJ0dN5bH4O9blk/Rfe1IDXpDJRlQzEt2isYrXih8vv/I= X-Received: by 2002:a17:906:3615:b0:a68:7212:7184 with SMTP id a640c23a62f3a-a6c75fb0aecmr449845266b.14.1717753197517; Fri, 07 Jun 2024 02:39:57 -0700 (PDT) MIME-Version: 1.0 References: <87a5jz5j88.fsf@localhost> <87ikylgldt.fsf@localhost> In-Reply-To: <87ikylgldt.fsf@localhost> From: Giuseppe Pagnoni Date: Fri, 7 Jun 2024 11:39:46 +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="0000000000002662b0061a499590" 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -8.67 X-Spam-Score: -8.67 X-Migadu-Queue-Id: E1A606038E X-Migadu-Scanner: mx13.migadu.com X-TUID: t8a3n1iUW8KC --0000000000002662b0061a499590 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ok, I just found out! You need to close the device after each plot: #+begin_src R :results output raw drawer :dir ./ x <- rnorm(100) print(mean(x)) png(file=3D"hist1.png") hist(x) dev.off() png(file=3D"hist2.png") hist(x^2) dev.off() print("[[./hist1.png]]") print("[[./hist2.png]]") #+end_src thanks! On Fri, Jun 7, 2024 at 11:18=E2=80=AFAM Ihor Radchenko wrote: > Giuseppe Pagnoni writes: > > > 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 no= t > > get saved (in the current directory or elsewhere), and I actually do no= t > > get any error messages in the R buffer (I also tried to change the file > > type to jpeg). Any idea why? > > Hard to say. > Try to run my example in command line R repl. > > -- > 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 --0000000000002662b0061a499590 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ok, I just found out!=C2=A0 You need to close the device a= fter each plot:

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

= thanks!

On Fri, Jun 7, 2024 at 11:18=E2=80=AFAM Ihor Radchenko <yantar92@posteo.net> wrote:
<= /div>
Giuseppe Pagnoni <= ;gpagnoni@gmail.com= > writes:

> 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 n= ot
> get saved (in the current directory or elsewhere), and I actually do n= ot
> get any error messages in the R buffer (I also tried to change the fil= e
> type to jpeg).=C2=A0 Any idea why?

Hard to say.
Try to run my example in command line R repl.

--
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

--0000000000002662b0061a499590--