Re: [R] Lattice + Word: Changing .wmf files to .pdf files
I also use R PDF graphic files; however, note that they can be imported directly into Word, at least on my version of Word which is Word 2007 on Windows Vista SP1, using Insert | Object (_not_ Insert | Picture) eliminating the intermediate step. On Thu, Jun 5, 2008 at 9:56 AM, Soukup, Mat <[EMAIL PROTECTED]> wrote: > Hi All, > > I'm by no means an expert on anything related to M$ products... However > I was recently forced (reluctantly at that) to put together a PPT > presentation which included multiple R graphics. So I thought I'd share > what I found to produce decent looking graphics. > > I created all the graphics from R as PDF files making sure to size them > accordingly by using the height and width arguments in the pdf function. > I would then open the graphics with Acrobat Professional and use the > snapshot tool (camera icon) to copy the image. This image was then > easily pasted into PPT (or Word in your case) which looked quite well. > At least this seemed to work out all right on my Windows XP PC. > > Hope this helps, > > -Mat > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Mike Prager > Sent: Thursday, June 05, 2008 9:38 AM > To: [EMAIL PROTECTED] > Subject: Re: [R] Lattice + Word: Changing .wmf files to .pdf files > > Jim Price <[EMAIL PROTECTED]> wrote: > >> [...] >> Currently we are using windows metafile format for in-text tables for >> reports created in Word. However, we've discovered some artifactual > lines >> being created in our final output once the Word document is changed to > PDF. >> The process is as follows: >> [...] >> >> If any one can shed enlightenment (or suggest an alternative approach > that >> preserves decent fidelity - we've struggled with postscript files in > the >> past, but this may be our opportunity to try them out again), it would > be >> much appreciated. > > The best approach depends on how much you care about the Word > files looking their best before conversion, vs. caring most > about the PDF. > > If you care most about the PDF, you can save your graphics as > EPS files from R (either by using the postscript device or the > savePlot function with type = "eps"). I tried one EPS file, and > found that Word 2007 imported EPS better than some older > versions. When I converted to PDF, the graphic was sharp and > clear. The downside of this approach is that before the > conversion Word displays the EPS graphic as a rough bitmapped > preview -- quite workable, but not suitable for final version. > > If you want both Word and PDF versions to look good, there is no > perfect solution. You could try generating the graphics as PNG, > which will look good (but not great) in both places. That > approach will likely increase file sizes considerably. > > Hope that helps. > > -- > Mike Prager, NOAA, Beaufort, NC > * Opinions expressed are personal and not represented otherwise. > * Any use of tradenames does not constitute a NOAA endorsement. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice + Word: Changing .wmf files to .pdf files
Hi All, I'm by no means an expert on anything related to M$ products... However I was recently forced (reluctantly at that) to put together a PPT presentation which included multiple R graphics. So I thought I'd share what I found to produce decent looking graphics. I created all the graphics from R as PDF files making sure to size them accordingly by using the height and width arguments in the pdf function. I would then open the graphics with Acrobat Professional and use the snapshot tool (camera icon) to copy the image. This image was then easily pasted into PPT (or Word in your case) which looked quite well. At least this seemed to work out all right on my Windows XP PC. Hope this helps, -Mat -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Prager Sent: Thursday, June 05, 2008 9:38 AM To: [EMAIL PROTECTED] Subject: Re: [R] Lattice + Word: Changing .wmf files to .pdf files Jim Price <[EMAIL PROTECTED]> wrote: > [...] > Currently we are using windows metafile format for in-text tables for > reports created in Word. However, we've discovered some artifactual lines > being created in our final output once the Word document is changed to PDF. > The process is as follows: > [...] > > If any one can shed enlightenment (or suggest an alternative approach that > preserves decent fidelity - we've struggled with postscript files in the > past, but this may be our opportunity to try them out again), it would be > much appreciated. The best approach depends on how much you care about the Word files looking their best before conversion, vs. caring most about the PDF. If you care most about the PDF, you can save your graphics as EPS files from R (either by using the postscript device or the savePlot function with type = "eps"). I tried one EPS file, and found that Word 2007 imported EPS better than some older versions. When I converted to PDF, the graphic was sharp and clear. The downside of this approach is that before the conversion Word displays the EPS graphic as a rough bitmapped preview -- quite workable, but not suitable for final version. If you want both Word and PDF versions to look good, there is no perfect solution. You could try generating the graphics as PNG, which will look good (but not great) in both places. That approach will likely increase file sizes considerably. Hope that helps. -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice + Word: Changing .wmf files to .pdf files
Jim Price <[EMAIL PROTECTED]> wrote: > [...] > Currently we are using windows metafile format for in-text tables for > reports created in Word. However, we've discovered some artifactual lines > being created in our final output once the Word document is changed to PDF. > The process is as follows: > [...] > > If any one can shed enlightenment (or suggest an alternative approach that > preserves decent fidelity - we've struggled with postscript files in the > past, but this may be our opportunity to try them out again), it would be > much appreciated. The best approach depends on how much you care about the Word files looking their best before conversion, vs. caring most about the PDF. If you care most about the PDF, you can save your graphics as EPS files from R (either by using the postscript device or the savePlot function with type = "eps"). I tried one EPS file, and found that Word 2007 imported EPS better than some older versions. When I converted to PDF, the graphic was sharp and clear. The downside of this approach is that before the conversion Word displays the EPS graphic as a rough bitmapped preview -- quite workable, but not suitable for final version. If you want both Word and PDF versions to look good, there is no perfect solution. You could try generating the graphics as PNG, which will look good (but not great) in both places. That approach will likely increase file sizes considerably. Hope that helps. -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Lattice + Word: Changing .wmf files to .pdf files
Jim Price hotmail.com> writes: > > > My apriori apologies if this is felt to be the wrong list for this issue - > although it starts with R, it's a combination of programs that creates the > problem. > > Currently we are using windows metafile format for in-text tables for > reports created in Word. However, we've discovered some artifactual lines > being created in our final output once the Word document is changed to PDF. > The process is as follows: > ... example > > This is then imported into Word 2008 (running on XP Pro 2002 with service > pack 2) using the import picture tool. The resulting file is then saved as a > PDF from Word. > > Although the .wmf file (and R console output if sent to there) look exactly > as you'd expect, there are a series of diagonal lines running from the > bottom of the panel.abline created index line to the upper bound of each > panel. I could reproduce this, and the same occurs when you export via AdobePdf virtual printer. I had not seen this feature before, but it is rather harmless compared to another issue: wmf and emf do not correctly clip data, so if you do not use automatic scaling, some of you points may end up in the wrong panel. I spoke to the developer of the gsview emf converter, and he confirmed that nothing could be done about it, it is a bug in the specification. Therefore, we do no longer use emf/wmf. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Lattice + Word: Changing .wmf files to .pdf files
My apriori apologies if this is felt to be the wrong list for this issue - although it starts with R, it's a combination of programs that creates the problem. Currently we are using windows metafile format for in-text tables for reports created in Word. However, we've discovered some artifactual lines being created in our final output once the Word document is changed to PDF. The process is as follows: # Simplest example code that contains all the sample features that create the problem library(lattice) test <- expand.grid(type = paste('Type', 1:4), success = c('Yes','No')) test$result <- exp(rnorm(nrow(test))) win.metafile('u:\\test.wmf') dotplot( success ~ result | type, data = test, panel = function(...) { panel.xyplot(...) panel.abline(v = 0, lty = 2) }, xlim = c(-10, 10) ) dev.off() This is then imported into Word 2008 (running on XP Pro 2002 with service pack 2) using the import picture tool. The resulting file is then saved as a PDF from Word. Although the .wmf file (and R console output if sent to there) look exactly as you'd expect, there are a series of diagonal lines running from the bottom of the panel.abline created index line to the upper bound of each panel. I confess to being somewhat confused - if windows metafile formats and PDF are both vector graphic formats, I'm not sure where this extra line has come from. I suspect it may be an artifact from Word's PDF creating routine, but have no concrete proof of this. If any one can shed enlightenment (or suggest an alternative approach that preserves decent fidelity - we've struggled with postscript files in the past, but this may be our opportunity to try them out again), it would be much appreciated. > sessionInfo() R version 2.7.0 (2008-04-22) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] lattice_0.17-6 loaded via a namespace (and not attached): [1] grid_2.7.0 Jim Price. Cardiome Pharma Corp. -- View this message in context: http://www.nabble.com/Lattice-%2B-Word%3A-Changing-.wmf-files-to-.pdf-files-tp17651766p17651766.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.