emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [babwel] Simplify graph generation and copying?


From: Andreas Leha
Subject: Re: [O] [babwel] Simplify graph generation and copying?
Date: Fri, 30 Mar 2012 21:04:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux)

Rainer M Krug <address@hidden> writes:

> Hi
>
> I do the following to create a graph in R and then convert / copy / do other 
> stuff with it in the
> bash shell:
>
> #+header: :results graphics
> #+header: :file Test.pdf
> #+header: :width 4
> #+header: :height 8
> #+header: :pointsize 8
> #+begin_src R
>   plot(runif(100))
> #+end_src
>
> #+BEGIN_SRC sh :session shell
>   cp Test.pdf Test2.pdf
> #+END_SRC
>
>
> Is there a way of automatically giving the ffile name from the :file 
> parameter tio the second code
> block, so that I just have to change the :file argument when I want a 
> different name for the graph?
>
> Thanks,
>
> Rainer


Hi Rainer,

I am not aware of any possibility to pass the :file parameter from one
code block to another.  But for your use case, the file name is also
the return value of the R code block.  So, you can do:

#+name: mypdfplot
#+header: :results graphics
#+header: :file Test.pdf
#+header: :width 4
#+header: :height 8
#+header: :pointsize 8
#+begin_src R
  plot(runif(100))
#+end_src


#+BEGIN_SRC sh :session shell :var mypdf=mypdfplot()
  cp "$mypdf" Test2.pdf
#+END_SRC

Best,
Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]