From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [babel] Give a name to the plot Date: Thu, 03 Dec 2009 18:58:32 -0500 Message-ID: <87my1z3907.fsf@stats.ox.ac.uk> References: <874oo73bss.fsf@mundaneum.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGLZL-0005pg-7h for emacs-orgmode@gnu.org; Thu, 03 Dec 2009 18:58:43 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGLZG-0005lu-HQ for emacs-orgmode@gnu.org; Thu, 03 Dec 2009 18:58:42 -0500 Received: from [199.232.76.173] (port=32916 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGLZG-0005lp-Do for emacs-orgmode@gnu.org; Thu, 03 Dec 2009 18:58:38 -0500 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:43183) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGLZG-0002Vr-1O for emacs-orgmode@gnu.org; Thu, 03 Dec 2009 18:58:38 -0500 In-Reply-To: <874oo73bss.fsf@mundaneum.com> (=?utf-8?Q?=22S=C3=A9bastien?= Vauban"'s message of "Thu, 03 Dec 2009 23:58:11 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?S=C3=A9bastien?= Vauban Cc: emacs-orgmode@gnu.org S=C3=A9bastien Vauban writes: > Hi Eric and Dan, > > Just a quick question (before testing and answering properly, tomorrow, to > your post): how do you give a name to an R plot? > > Just taking your example file: > > #+srcname: directory-pie-chart(dirs =3D directories) > #+begin_src R :session R-pie-example > pie(dirs[,1], labels =3D dirs[,2]) > #+end_src > [[file:../../images/babel/dirs.png]] > > I don't see how the `dirs.png' name is derivated from the above block? Hi Seb, Sorry, more documentation shortcomings. When that was written it did not happen automatically, but it does now.=20=20 > I've tried arguments such as `:file' or `filename:', but did not get any > success... e.g. :file filename.png should do it. Here's the relevant commit note. I'll move this into the documentation now. commit 8b52bf09e0644cc5b6ea85e5248403fcd562f4f3 Author: Dan Davison Date: Mon Oct 19 21:00:24 2009 -0400 org-babel: capture graphical output from R =20=20=20=20 If a [:file filename.ext] header arg is provided, then all graphical output from the source block is captured on disk, and output of the source block is a link to the resulting file, as with the graphics-only languages such as gnuplot, ditaa, dot, asymptote. An attempt is made to find a graphics device corresponding to the file extension (currently .png, .jpg, .jpeg, .tiff, .bmp, .pdf, .ps, .postscript are recognised); if that fails, png format output is created. =20=20=20=20 Additionally, values for several arguments to the R graphics device can be passed using header args: =20=20=20=20 :width :height :bg :units :pointsize :antialias :quality :compression :res :type :family :title :fonts :version :paper :encoding :pagecentre :colormodel :useDingbats :horizontal =20=20=20=20 Arguments to the R graphics device that are not supported as header args can be passed as a string in R argument syntax, using the header arg :R-dev-args =20=20=20=20 An example block is (although both bg and fg can be passed directly as header args) =20=20=20=20 \#+begin_src R :file z.pdf :width 8 :height 8 :R-dev-args bg=3D"olivedr= ab", fg=3D"hotpink" plot(matrix(rnorm(100), ncol=3D2), type=3D"l") \#+end_src > > Currently, all my R blocks produce an `Rplots.pdf' graph file... Don't see > where that is coming from... Pay attention: I'm an R user for the last 3 = days That is the default in R when you issue plot commands from a non-interactive R process. But if you use the :file header arg all graphical output will be diverted to the named file as outlined above. dan > or so... Not very aware of where the name can be set... > > Best regards, > Seb