From: Giuseppe Pagnoni <gpagnoni@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: Output of R code block: only text or plot but not both? And only one "result" can be output?
Date: Fri, 7 Jun 2024 11:10:51 +0200 [thread overview]
Message-ID: <CAAdktExUdHATB3czuQSZMA3WTsQ+0CbynMC+GMGUPqgq+po3dQ@mail.gmail.com> (raw)
In-Reply-To: <87a5jz5j88.fsf@localhost>
[-- Attachment #1: Type: text/plain, Size: 1731 bytes --]
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 PM Ihor Radchenko <yantar92@posteo.net> wrote:
> Giuseppe Pagnoni <gpagnoni@gmail.com> 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="hist1.png")
> hist(x)
> png(file="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 <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>
--
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
[-- Attachment #2: Type: text/html, Size: 2645 bytes --]
next prev parent reply other threads:[~2024-06-07 9:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-03 13:47 Output of R code block: only text or plot but not both? And only one "result" can be output? Giuseppe Pagnoni
2024-06-05 17:36 ` Berry, Charles
2024-06-05 18:17 ` [FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?) Ihor Radchenko
2024-06-05 20:34 ` Berry, Charles
2024-06-07 10:46 ` Ideas for improving ob-R (was: [FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?)) Ihor Radchenko
2024-06-05 18:37 ` Output of R code block: only text or plot but not both? And only one "result" can be output? Ihor Radchenko
2024-06-07 8:56 ` Giuseppe Pagnoni
2024-06-07 9:10 ` Giuseppe Pagnoni [this message]
2024-06-07 9:19 ` Ihor Radchenko
2024-06-07 9:31 ` Giuseppe Pagnoni
2024-06-07 9:39 ` Giuseppe Pagnoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAdktExUdHATB3czuQSZMA3WTsQ+0CbynMC+GMGUPqgq+po3dQ@mail.gmail.com \
--to=gpagnoni@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).