From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Images from R in LaTeX and PDF Date: Sat, 8 Jan 2011 12:28:17 +0000 Message-ID: Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=42705 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbXuC-0005ou-SS for emacs-orgmode@gnu.org; Sat, 08 Jan 2011 07:28:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbXuB-0003j3-OX for emacs-orgmode@gnu.org; Sat, 08 Jan 2011 07:28:24 -0500 Received: from mail-wy0-f169.google.com ([74.125.82.169]:32851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbXuB-0003ik-GX for emacs-orgmode@gnu.org; Sat, 08 Jan 2011 07:28:23 -0500 Received: by wyj26 with SMTP id 26so18998023wyj.0 for ; Sat, 08 Jan 2011 04:28:22 -0800 (PST) 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: benjamin.ward@bathspa.org Cc: emacs-orgmode@gnu.org Ben Ward writes: > #+begin_src R :exports both > full <- read.csv(file=3D"~/Documents/BSc Biology/Third = Year/BY6001-40 -=20 > Dissertation/Data and Analysis/Evolution Results.csv", head=3DT) > library("lattice") > ecoli =3D subset(full, Bacterium=3D=3D"E.coli") > edett =3D subset(ecoli, Cleaner=3D=3D"Dettol") > egarl =3D subset(ecoli, Cleaner=3D=3D"Garlic") > MIC.mod =3D lm(MIC. ~ 1+Challenge*Cleaner*Replicate, data=3Decoli) > #+end_src Hi Ben, Use the :width and :height header args to alter the dimensions of the graphics. The arguments go straight through to the R device, so if you are plotting to pdf they will be interpreted as inches (whereas they will be pixels for png, jpeg etc). With current Org, you will also need :results graphics in order to tell R to send graphics to the designated file. In addition, with lattice graphics, unless you are using :session, I believe you will need :results output (so :results output graphics). Do get back to us with any problems. There are several people who routinely use R to include graphics in Org documents. Dan p.s. Request to everyone: can we try as much as possible to use reproducible examples on-list? I.e. toy examples that anyone can execute, instead of real examples that rely on datasets that not everyone has access to. > #+begin_src R :file fig1.pdf > xyplot( MIC.+fitted(MIC.mod) ~ Challenge, data=3Decoli,=20 > xlab=3D"Challenge", ylab=3D"MIC %", auto.key=3DTRUE) > #+end_src > > #+attr_latex: width=3D0.6\textwidth wrap placement=3D{h}{0.4\textwidth} > #+label: fig:one > #+caption: Linar Plot of real data and fitted model values > #+results: fig1 > [[file:fig1.pdf]] > > In the case of this code, actually altering size works, but it keeps=20= > putting the image at the end of my document. Then other images, placed=20= > with pretty much the same code, give or take for filenames and such,=20= > won't increace in size, but will alter their movement. > I'm wondering if using pure latex for my images would be an easier = solution. > > Cheers, > Ben. > > > On 07/01/2011 18:30, Thomas S. Dye wrote: >> Aloha Ben, >> >> Can you share an example that doesn't work for you? >> >> All the best, >> Tom >> >> On Jan 7, 2011, at 7:23 AM, Ben Ward wrote: >> >>> Hi All, >>> >>> I've been doing some work with babel and R to generate graphs that=20= >>> I've then been including useing attr latex. >>> >>> But when I include images the always appear very very small, even=20 >>> when I mess about with the width settings of the attr latex line and=20= >>> remove the options for wrap and such. >>> >>> Does anybody else use R with images and org, and could tell me how=20= >>> they handle including R graphics in their documents? >>> >>> Thanks, >>> Ben. W >>> >>> _______________________________________________ >>> Emacs-orgmode mailing list >>> Please use `Reply All' to send replies to the list. >>> Emacs-orgmode@gnu.org >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode >> >> >> > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode