From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [babwel] Simplify graph generation and copying? Date: Fri, 30 Mar 2012 21:04:40 +0200 Message-ID: <87mx6xdi5z.fsf@med.uni-goettingen.de> References: <4F745867.3060104@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDh8d-0004xg-2w for emacs-orgmode@gnu.org; Fri, 30 Mar 2012 15:05:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDh8b-00033b-B7 for emacs-orgmode@gnu.org; Fri, 30 Mar 2012 15:05:30 -0400 Received: from plane.gmane.org ([80.91.229.3]:36628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDh8b-00033P-4I for emacs-orgmode@gnu.org; Fri, 30 Mar 2012 15:05:29 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SDh8X-00043Y-VA for emacs-orgmode@gnu.org; Fri, 30 Mar 2012 21:05:25 +0200 Received: from vpn-2111.gwdg.de ([134.76.2.111]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 Mar 2012 21:05:25 +0200 Received: from andreas.leha by vpn-2111.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 30 Mar 2012 21:05:25 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Rainer M Krug 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