* babel: textual output and graphic results
@ 2011-06-24 10:10 Eythan Weg
[not found] ` <BANLkTimOd4mfgvbDxaR1xF3WjPFPFYwT57keREjdp5vtFep5PQ@mail.gmail.com>
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Eythan Weg @ 2011-06-24 10:10 UTC (permalink / raw)
To: emacs-orgmode
Hi,
How could I effect the plot saved in a file and the output produced
shown in the buffer by using a single execution of R in the following
snippet?
#+begin_src R :results output :session
print(seq(1,10))
plot(seq(1,10))
#+end_src
Thank you.
Eythan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
[not found] ` <87iprvph8y.fsf@gmail.com>
@ 2011-06-24 12:28 ` Rainer M Krug
2011-06-25 12:00 ` Eythan Weg
0 siblings, 1 reply; 8+ messages in thread
From: Rainer M Krug @ 2011-06-24 12:28 UTC (permalink / raw)
To: Eythan Weg, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1810 bytes --]
On Fri, Jun 24, 2011 at 2:05 PM, Eythan Weg <eythanweg@gmail.com> wrote:
>
>
>
> Thank you. True. But, I would like, if possible, to have the link to
> the saved plot as a link in the output, for free.
>
Just add it as a cat() statement:
#+begin_src R :results output :session
print(seq(1,10))
pdf("ThePlot.pdf")
plot(seq(1,10))
dev.off()
cat("[[./ThePlot.pdf]]")
#+end_src
> Eythan
>
>
> Rainer M Krug <r.m.krug@gmail.com>
> Fri, 24 Jun 2011 13:18:36 +0200
>
> On Fri, Jun 24, 2011 at 12:10 PM, Eythan Weg <eythanweg@gmail.com>
> wrote:
>
>
> Hi,
>
> How could I effect the plot saved in a file and the output
> produced
> shown in the buffer by using a single execution of R in the
> following
> snippet?
>
>
>
> Why not the old R way:
>
> #+begin_src R :results output :session
> print(seq(1,10))
>
> pdf("ThePlot.pdf")
>
> plot(seq(1,10))
>
> dev.off()
>
> #+end_src
>
>
> Rainer
>
>
> Thank you.
> Eythan
>
>
>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel : +33 - (0)9 53 10 27 44
> Cell: +33 - (0)6 85 62 59 98
> Fax (F): +33 - (0)9 58 10 27 44
>
> Fax (D): +49 - (0)3 21 21 25 22 44
>
> email: Rainer@krugs.de
>
> Skype: RMkrug
>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
[-- Attachment #2: Type: text/html, Size: 3210 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
2011-06-24 10:10 babel: textual output and graphic results Eythan Weg
[not found] ` <BANLkTimOd4mfgvbDxaR1xF3WjPFPFYwT57keREjdp5vtFep5PQ@mail.gmail.com>
@ 2011-06-24 18:11 ` Eric Schulte
2011-06-25 12:05 ` Eythan Weg
2011-06-24 18:46 ` Russell Adams
2 siblings, 1 reply; 8+ messages in thread
From: Eric Schulte @ 2011-06-24 18:11 UTC (permalink / raw)
To: Eythan Weg; +Cc: emacs-orgmode
eythanweg@gmail.com (Eythan Weg) writes:
> Hi,
>
> How could I effect the plot saved in a file and the output produced
> shown in the buffer by using a single execution of R in the following
> snippet?
>
Each code block can only return a single output type, so you will have
to split your code block into two, however (given that you are using
sessions) this should not affect the runtime behavior. The following
will work...
#+begin_src R :results output :session
print(seq(1,10))
#+end_src
#+begin_src R :file example.png :session
plot(seq(1,10))
#+end_src
Best -- Eric
>
> #+begin_src R :results output :session
> print(seq(1,10))
> plot(seq(1,10))
> #+end_src
>
> Thank you.
> Eythan
>
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
2011-06-24 10:10 babel: textual output and graphic results Eythan Weg
[not found] ` <BANLkTimOd4mfgvbDxaR1xF3WjPFPFYwT57keREjdp5vtFep5PQ@mail.gmail.com>
2011-06-24 18:11 ` Eric Schulte
@ 2011-06-24 18:46 ` Russell Adams
2 siblings, 0 replies; 8+ messages in thread
From: Russell Adams @ 2011-06-24 18:46 UTC (permalink / raw)
To: emacs-orgmode
Eythan,
This sounds similar to something I'd already done on Worg, ie: dual
format returns in R. The first example (RBabelExample) is really R
outputting to PNG for viewing inline in emacs with inline-images, and
PDF for inclusion into Latex.
Maybe you can adapt it to return your text, and graph separately.
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
Enjoy.
On Fri, Jun 24, 2011 at 06:10:47AM -0400, Eythan Weg wrote:
>
> Hi,
>
> How could I effect the plot saved in a file and the output produced
> shown in the buffer by using a single execution of R in the following
> snippet?
>
> #+begin_src R :results output :session
> print(seq(1,10))
> plot(seq(1,10))
> #+end_src
>
> Thank you.
> Eythan
>
>
------------------------------------------------------------------
Russell Adams RLAdams@AdamsInfoServ.com
PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/
Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
2011-06-24 12:28 ` Rainer M Krug
@ 2011-06-25 12:00 ` Eythan Weg
2011-06-25 17:45 ` Rainer M Krug
0 siblings, 1 reply; 8+ messages in thread
From: Eythan Weg @ 2011-06-25 12:00 UTC (permalink / raw)
To: Rainer M Krug; +Cc: emacs-orgmode
True again. It solves the problem by bypassing a babel's weakness, I think.
Eythan
Rainer M Krug <r.m.krug@gmail.com>
Fri, 24 Jun 2011 14:28:41 +0200
On Fri, Jun 24, 2011 at 2:05 PM, Eythan Weg <eythanweg@gmail.com>
wrote:
Thank you. True. But, I would like, if possible, to have the link
to
the saved plot as a link in the output, for free.
Just add it as a cat() statement:
#+begin_src R :results output :session
print(seq(1,10))
pdf("ThePlot.pdf")
plot(seq(1,10))
dev.off()
cat("[[./ThePlot.pdf]]")
#+end_src
Eythan
Rainer M Krug <r.m.krug@gmail.com>
Fri, 24 Jun 2011 13:18:36 +0200
On Fri, Jun 24, 2011 at 12:10 PM, Eythan Weg <eythanweg@gmail.com>
wrote:
Hi,
How could I effect the plot saved in a file and the output
produced
shown in the buffer by using a single execution of R in the
following
snippet?
Why not the old R way:
#+begin_src R :results output :session
print(seq(1,10))
pdf("ThePlot.pdf")
plot(seq(1,10))
dev.off()
#+end_src
Rainer
Thank you.
Eythan
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
2011-06-24 18:11 ` Eric Schulte
@ 2011-06-25 12:05 ` Eythan Weg
2011-06-25 18:41 ` Eric Schulte
0 siblings, 1 reply; 8+ messages in thread
From: Eythan Weg @ 2011-06-25 12:05 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
Eric Schulte <schulte.eric@gmail.com>
Fri, 24 Jun 2011 11:11:52 -0700
eythanweg@gmail.com (Eythan Weg) writes:
> Hi,
>
> How could I effect the plot saved in a file and the output produced
> shown in the buffer by using a single execution of R in the following
> snippet?
>
Each code block can only return a single output type, so you will have
Is this property fundamental, or temporary?
to split your code block into two, however (given that you are using
sessions) this should not affect the runtime behavior. The following
will work...
#+begin_src R :results output :session
print(seq(1,10))
#+end_src
#+begin_src R :file example.png :session
plot(seq(1,10))
#+end_src
Best -- Eric
Thank you.
Eythan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
2011-06-25 12:00 ` Eythan Weg
@ 2011-06-25 17:45 ` Rainer M Krug
0 siblings, 0 replies; 8+ messages in thread
From: Rainer M Krug @ 2011-06-25 17:45 UTC (permalink / raw)
To: Eythan Weg; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]
On Sat, Jun 25, 2011 at 2:00 PM, Eythan Weg <eythanweg@gmail.com> wrote:
>
>
> True again. It solves the problem by bypassing a babel's weakness, I
> think.
>
I would not say babel's weakness - rether a strength which result's in it's
simplicity and power.
Rainer
> Eythan
>
> Rainer M Krug <r.m.krug@gmail.com>
> Fri, 24 Jun 2011 14:28:41 +0200
>
> On Fri, Jun 24, 2011 at 2:05 PM, Eythan Weg <eythanweg@gmail.com>
> wrote:
>
>
>
>
> Thank you. True. But, I would like, if possible, to have the link
> to
> the saved plot as a link in the output, for free.
>
>
> Just add it as a cat() statement:
>
> #+begin_src R :results output :session
> print(seq(1,10))
> pdf("ThePlot.pdf")
> plot(seq(1,10))
> dev.off()
> cat("[[./ThePlot.pdf]]")
> #+end_src
>
>
> Eythan
>
>
> Rainer M Krug <r.m.krug@gmail.com>
> Fri, 24 Jun 2011 13:18:36 +0200
>
>
>
>
> On Fri, Jun 24, 2011 at 12:10 PM, Eythan Weg <eythanweg@gmail.com>
> wrote:
>
>
> Hi,
>
> How could I effect the plot saved in a file and the output
> produced
> shown in the buffer by using a single execution of R in the
> following
> snippet?
>
>
>
> Why not the old R way:
>
> #+begin_src R :results output :session
> print(seq(1,10))
>
> pdf("ThePlot.pdf")
>
> plot(seq(1,10))
>
> dev.off()
>
> #+end_src
>
>
> Rainer
>
>
> Thank you.
> Eythan
>
>
>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel : +33 - (0)9 53 10 27 44
> Cell: +33 - (0)6 85 62 59 98
> Fax (F): +33 - (0)9 58 10 27 44
>
> Fax (D): +49 - (0)3 21 21 25 22 44
>
> email: Rainer@krugs.de
>
> Skype: RMkrug
>
>
>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel : +33 - (0)9 53 10 27 44
> Cell: +33 - (0)6 85 62 59 98
> Fax (F): +33 - (0)9 58 10 27 44
>
> Fax (D): +49 - (0)3 21 21 25 22 44
>
> email: Rainer@krugs.de
>
> Skype: RMkrug
>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax (F): +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer@krugs.de
Skype: RMkrug
[-- Attachment #2: Type: text/html, Size: 4762 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: babel: textual output and graphic results
2011-06-25 12:05 ` Eythan Weg
@ 2011-06-25 18:41 ` Eric Schulte
0 siblings, 0 replies; 8+ messages in thread
From: Eric Schulte @ 2011-06-25 18:41 UTC (permalink / raw)
To: Eythan Weg; +Cc: emacs-orgmode
>
> Each code block can only return a single output type, so you will have
>
> Is this property fundamental, or temporary?
>
This is intentional and will not be changed.
The alternative would introduce many complications without adding any
real new expressive power to code blocks.
Best -- Eric
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-06-25 18:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-24 10:10 babel: textual output and graphic results Eythan Weg
[not found] ` <BANLkTimOd4mfgvbDxaR1xF3WjPFPFYwT57keREjdp5vtFep5PQ@mail.gmail.com>
[not found] ` <87iprvph8y.fsf@gmail.com>
2011-06-24 12:28 ` Rainer M Krug
2011-06-25 12:00 ` Eythan Weg
2011-06-25 17:45 ` Rainer M Krug
2011-06-24 18:11 ` Eric Schulte
2011-06-25 12:05 ` Eythan Weg
2011-06-25 18:41 ` Eric Schulte
2011-06-24 18:46 ` Russell Adams
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).