Here is how to print graphs for inclusion in Latex. First make sure you've got the graph you want. Do this by repeating and editing the command to make the graph, in the usual way. (Yes, I know Miktex is good, but it isn't as good as Emacs with ESS, although I admit that I could never configure Emacs properly on Windows - which was reason #23.5 for giving up Windows.) Second, say postscript("foo.eps") where foo.eps is the file name. I discovered this by saying apropos(postscript) and then I looked at ?postscript Then run the command again, and say dev.off() To include the graph in Latex, make sure you have something like \usepackage[dvips]{graphicx} in your header. Then, where you want the graph, say something like \includegraphics[width=4in]{foo.eps} Jon Baron -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 7 Dec 2001, Jonathan Baron wrote:> Here is how to print graphs for inclusion in Latex. > > First make sure you've got the graph you want. Do this by > repeating and editing the command to make the graph, in the usual > way. (Yes, I know Miktex is good, but it isn't as good as Emacs > with ESS, although I admit that I could never configure Emacs > properly on Windows - which was reason #23.5 for giving up > Windows.) > > Second, say > postscript("foo.eps") > where foo.eps is the file name. I discovered this by > saying > apropos(postscript) > and then I looked at > ?postscriptPlease look it up again. That's not all you need to get proper EPSF, and you also need to worry about aspect ratios and pointsizes. E.g. The postscript produced by R is EPS (Encapsulated PostScript) compatible, and can be included into other documents, e.g. into LaTeX, using `\includegraphics{<filename>}'. For use in this way you will probably want to set `horizontal=FALSE, onefile=FALSE, paper="special"'. It is usually *much* easier to use dev.copy2eps() or, on Windows, the `Save as' on the File menu.> Then run the command again, and say > dev.off() > > To include the graph in Latex, make sure you have something like > \usepackage[dvips]{graphicx} > in your header. Then, where you want the graph, say something > like > \includegraphics[width=4in]{foo.eps}You'll need to set a bounding box if you do that, and quite possibly rotate the figure. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, stats.ox.ac.uk/~ripley University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 19:57 06/12/01 -0800, Brian Scholl wrote:>Sorry this is more of a Latex than an R question. I'd >like to be able to insert figures created in R in a >Latex document. I'm a bit new to Latex so please >speak slowly. I'm using winedt/miktex (great >programs incidentally). > >Thanks, > >BrianHi Brian, I found two ways to nicely produce figures for inclusion in LaTeX: 1) use the postscript device, eg: postscript(file="myfig1.ps", width=..., height=..., horizontal=FALSE) plot(...) .... dev.off() I think you need to specify horizontal=FALSE (the default is TRUE) to have something ok when inseting in LaTeX. 2) use the function dev.copy2eps() from the R command line, eg you do your figure on your windows device and when you are happy with it, type the command: dev.copy2eps(file="myfig1.eps") I found that both ways produce files that can be inserted "as is" in LaTeX documents (ie, no need to edit/modify them with Illustrator, GhostScript...). If you use the menu File|Save as|Postscript from the windows device, the resulting PS file does not include nicely in LaTeX. I use Emacs with RefTeX and AucTeX to edit my .tex files, and this great as well. Hope this helps Emmanuel Paradis -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._