Robert Dodier
2021-Feb-18 17:50 UTC
[R] ISO recommendations for plot output format from R to MS Word
Hi, a quick follow-up about the question about putting R-generated figures into MS Word. I have found by experimenting with some figures and documents that if I import an SVG figure generated by svglite (didn't try other output functions), I can view it okay in my installation of MS Word (Word for Mac 16.16.10), and it looks okay in MS Word for Windows (circa 2016 or 2018) on a laptop I have, and two other people can view it okay (one on Mac and one on Windows). So that seems safe enough to go ahead. YMMV. I am informed that MS Word is actually storing a bitmap image of the SVG figure, which is displayed by non-SVG-aware versions of Word. So that seems like a good safeguard. For the record, I converted the SVG to EPS, PNG, PDF, WMF, and EMF via Imagemagick. EPS and PNG were tolerable, PDF was too fuzzy, and WMF and EMF, at least as generated, could not be displayed (I was a little surprised by that). There are, no doubt, many unanswered questions here, which unfortunately I cannot take the time to explore right now. In summary I found that importing SVG generated by svglite into MS Word for Mac seems to work okay to generate a generally-readable file. Perhaps this experience is useful in some way to others. best, Robert Dodier
Kevin Thorpe
2021-Feb-18 18:12 UTC
[R] ISO recommendations for plot output format from R to MS Word
I did not see the original thread so this may have been discussed. I would think that it would be more seamless to use Rmarkdown. Simply put the plotting code into an Rmarkdown file and send it straight to Word. Is there a reason why this is not a viable option? -- Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016> On Feb 18, 2021, at 12:50 PM, Robert Dodier <robert.dodier at gmail.com> wrote: > > EXTERNAL EMAIL: > > Hi, a quick follow-up about the question about putting R-generated > figures into MS Word. > > I have found by experimenting with some figures and documents that if > I import an SVG figure generated by svglite (didn't try other output > functions), I can view it okay in my installation of MS Word (Word for > Mac 16.16.10), and it looks okay in MS Word for Windows (circa 2016 or > 2018) on a laptop I have, and two other people can view it okay (one > on Mac and one on Windows). So that seems safe enough to go ahead. > YMMV. > > I am informed that MS Word is actually storing a bitmap image of the > SVG figure, which is displayed by non-SVG-aware versions of Word. So > that seems like a good safeguard. > > For the record, I converted the SVG to EPS, PNG, PDF, WMF, and EMF via > Imagemagick. EPS and PNG were tolerable, PDF was too fuzzy, and WMF > and EMF, at least as generated, could not be displayed (I was a little > surprised by that). There are, no doubt, many unanswered questions > here, which unfortunately I cannot take the time to explore right now. > > In summary I found that importing SVG generated by svglite into MS > Word for Mac seems to work okay to generate a generally-readable file. > Perhaps this experience is useful in some way to others. > > best, > > Robert Dodier > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
Donald Macnaughton
2021-Feb-19 20:18 UTC
[R] ISO recommendations for plot output format from R to MS Word
The native graphics format in Microsoft Office (including Word) is EMF (Enhanced MetaFile), which is an enhanced version of WMF (Windows MetaFile). This is a VECTOR format with embedded scalable fonts, so it scales perfectly to all sizes. R will output EMF graph files using Philip Johnson's library(devEMF), which is on CRAN. These files can be imported into Word using Insert > Pictures > .... These images are "perfect" if the Word document is converted (by Word itself) to PDF, with unbitmapped fonts and lines, so they look perfect even if you zoom the PDF to 600%. I haven't tried lately, but in the past the driver generated huge files from ggplot2, but small files from the graphics and grid packages. Don Macnaughton -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Robert Dodier Sent: Thursday, February 18, 2021 12:50 PM To: r-help at r-project.org Subject: Re: [R] ISO recommendations for plot output format from R to MS Word Hi, a quick follow-up about the question about putting R-generated figures into MS Word. I have found by experimenting with some figures and documents that if I import an SVG figure generated by svglite (didn't try other output functions), I can view it okay in my installation of MS Word (Word for Mac 16.16.10), and it looks okay in MS Word for Windows (circa 2016 or 2018) on a laptop I have, and two other people can view it okay (one on Mac and one on Windows). So that seems safe enough to go ahead. YMMV. I am informed that MS Word is actually storing a bitmap image of the SVG figure, which is displayed by non-SVG-aware versions of Word. So that seems like a good safeguard. For the record, I converted the SVG to EPS, PNG, PDF, WMF, and EMF via Imagemagick. EPS and PNG were tolerable, PDF was too fuzzy, and WMF and EMF, at least as generated, could not be displayed (I was a little surprised by that). There are, no doubt, many unanswered questions here, which unfortunately I cannot take the time to explore right now. In summary I found that importing SVG generated by svglite into MS Word for Mac seems to work okay to generate a generally-readable file. Perhaps this experience is useful in some way to others. best, Robert Dodier ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.