Many thanks.  Since I am using this within an org-mode notebook, I think
the :session trick works well enough for me.

best
giuseppe

On Wed, Jun 5, 2024 at 8:35 PM Ihor Radchenko <yanta...@posteo.net> wrote:

> Giuseppe Pagnoni <gpagn...@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

Reply via email to