Anupam Tyagi
2006-Oct-04 17:11 UTC
[R] R Graphics: Saving PDF and other formats from Windows Graphic Device for LaTeX
Hello, I can't seem to save (or find the default location) when I use the Window Graphic Device's pull down menu. It does not seem to save to the directory I have set using "setwd(...)". How do I make the pull down menu's work? What is the best format to save R graphics for inclusion into a LaTeX documents? I will use PdfTex, or LaTeX -> PS -> PsToPdf to generate the final PDF file. Which is likely to give the best graphics quality in the final PDF document? The final graphs will be about 3x3 inch (fit in a column in two-column format). I will be grateful if someone can share their experience. Anupam.
Duncan Murdoch
2006-Oct-04 17:33 UTC
[R] R Graphics: Saving PDF and other formats from Windows Graphic Device for LaTeX
On 10/4/2006 1:11 PM, Anupam Tyagi wrote:> Hello, I can't seem to save (or find the default location) when I use the Window > Graphic Device's pull down menu. It does not seem to save to the directory I > have set using "setwd(...)". How do I make the pull down menu's work?If you want the best quality results, don't use the Save menu at all. Instead, write directly to a graphics device like pdf().> > What is the best format to save R graphics for inclusion into a LaTeX documents? > I will use PdfTex, or LaTeX -> PS -> PsToPdf to generate the final PDF file. > Which is likely to give the best graphics quality in the final PDF document? > The final graphs will be about 3x3 inch (fit in a column in two-column format). > I will be grateful if someone can share their experience.The postscript and pdf formats both give good results. Depending on your Latex setup, sometimes only one or the other will be supported. Duncan Murdoch
Jens Scheidtmann
2006-Oct-04 20:52 UTC
[R] R Graphics: Saving PDF and other formats from Windows Graphic Device for LaTeX
Anupam Tyagi <AnupTyagi at yahoo.com> writes: [...]> What is the best format to save R graphics for inclusion into a > LaTeX documents?When using pdflatex use pdf for graphics as reference format. Using ps2pdf or some such may have some problems when it comes to alpha channels and transparency. [...]> I will be grateful if someone can share their experience.Indispensable is having a good editing cycle. I.e. compile the latex, jump to the position where you are editing the file in the preview, double click somewhere in the preview, move to that position in your editor (or at least near that position). As I am not aware of any tools doing this with pdf, you may want to render dvi instead. When rendering DVI, you probably want to generate ps. My 2c, Jens
Anupam Tyagi
2006-Oct-05 05:10 UTC
[R] R Graphics: Saving PDF and other formats from Windows Graphic Device for LaTeX
Thanks. That worked. I am using the following to set-up the device: pdf("sgr6100.pdf", horizontal=FALSE, onefile=FALSE, height=3, width=3, pointsize=6) Reducing point-size below 6 does not seem to make any difference to the size of text and symbols. Any suggestions to get smaller font sizes? I am using WinEdt with MikTeX set-up. Any suggestions about something, or some packages, that might improve graphics inclusion. Latex complains about the [scale...] part for any scale in \includegraphics[scale=1]{} and pauses. Suggestions will be appreciated about what is the best way to scale R graphics for inclusion in LaTeX. Anupam.
Stefan Grosse
2006-Oct-05 07:41 UTC
[R] R Graphics: Saving PDF and other formats from Windows Graphic Device for LaTeX
> pdf("sgr6100.pdf", horizontal=FALSE, onefile=FALSE, > height=3, width=3, pointsize=6) > > Reducing point-size below 6 does not seem to make any difference to > the size of text and symbols. Any suggestions to get smaller font sizes? >I have never used the pointsize option. Increasing the height and the width decreases the relative size of the font so if you scale down the figure in LaTeX you would get smaller fonts.> I am using WinEdt with MikTeX set-up. >as well do I ...> Latex complains about the [scale...] part for any scale in > > \includegraphics[scale=1]{} >A scale of one does not make any sense since it is 100% or with other words you could leave that out. If you want to scale the figure to the text width you could write \begin{figure} \includegraphic[width=\textwidth]{sgr6100.pdf } \end{figure} btw. I use the postscript device to produce an eps file and dvipdfm to convert the dvi to pdf postscript("sgr6100.eps", width = 6, height = 6, horizontal = FALSE, onefile =T, paper="special") and then in LaTeX: \begin{figure} \includegraphic[width=\textwidth]{sgr6100} \end{figure}> and pauses. Suggestions will be appreciated about what is the best way to scale > R graphics for inclusion in LaTeX. > >see above. Have a look at a good LaTeX guide like lshort http://tobi.oetiker.ch/lshort/lshort.pdf (e.g. p.73/73) Stefan Grosse
Mike Prager
2006-Oct-05 20:11 UTC
[R] R Graphics: Saving PDF and other formats from Windows Graphic Device for LaTeX
Jens Scheidtmann <JensScheidtmann at web.de> wrote:> Indispensable is having a good editing cycle. I.e. compile the latex, > jump to the position where you are editing the file in the preview, > double click somewhere in the preview, move to that position in your > editor (or at least near that position). As I am not aware of any > tools doing this with pdf, you may want to render dvi instead.Agreed. As a point of interest, the newer Windows versions of vTeX (by MicroPress) will do this (in both directions) with PDF. This is a commercial TeX distribution with value added. They have a free distribution suitable for Unix or Linux, but I doubt that it does that particular trick. -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement.