Robert Dodier
2021-Feb-12 23:05 UTC
[R] ISO recommendations for plot output format from R to MS Word
I need to export plots (constructed with plot and with ggplot) from R to be imported into a MS Word document. I am working with MS Word for Mac version 16.16.10 (copyright 2018) and R versions 3.6.3 and/or 4.0.3. I have verified that the version of MS Word which I am working with can import SVG exported from R via svglite. What I am mostly worried about is that other people with possibly different versions of MS Word will not be able to view the document correctly. Towards the goal of creating an MS Word document which others with unspecified versions of MS Word can view correctly, in what format should I export figures from R? I am working with a fairly large number of figures so there is some motivation towards a fully automated process. I have searched various forums and archives, but much of the information may be out of date, so I am hoping that you can help me with some up to date information. Thank you very much for any light you can shed on this problem. Robert Dodier
Jinsong Zhao
2021-Feb-13 00:43 UTC
[R] ISO recommendations for plot output format from R to MS Word
On 2021/2/13 7:05, Robert Dodier wrote:> I need to export plots (constructed with plot and with ggplot) from R > to be imported into a MS Word document. > > I am working with MS Word for Mac version 16.16.10 (copyright 2018) > and R versions 3.6.3 and/or 4.0.3. > > I have verified that the version of MS Word which I am working with > can import SVG exported from R via svglite. > > What I am mostly worried about is that other people with possibly > different versions of MS Word will not be able to view the document > correctly. >On Windows, MS Word can not display the SVG imported. In my memory, the only fully supported vector graphic format is "emf" or "wmf" (both a same?). Encapsulated PostScript(EPS) seems to be supported with specific plugin (I am not very sure about it). However, some figures produced by win.metafile() could display correctly in Word, but weird when convert to PDF.> Towards the goal of creating an MS Word document which others with > unspecified versions of MS Word can view correctly, in what format > should I export figures from R? > > I am working with a fairly large number of figures so there is some > motivation towards a fully automated process. > > I have searched various forums and archives, but much of the > information may be out of date, so I am hoping that you can help me > with some up to date information. > > Thank you very much for any light you can shed on this problem. > > Robert Dodier >
Ivan Krylov
2021-Feb-13 06:55 UTC
[R] ISO recommendations for plot output format from R to MS Word
On Fri, 12 Feb 2021 15:05:33 -0800 Robert Dodier <robert.dodier at gmail.com> wrote:> Towards the goal of creating an MS Word document which others with > unspecified versions of MS Word can view correctly, in what format > should I export figures from R?A cross-platform plotting device designed specifically for word processors is devEMF. In my experience, best compatibility with Word can be achieved by creating figures with parameters (emfPlus = TRUE, emfPlusFont = FALSE, emfPlusRaster = TRUE), but I only checked Word 2003 and 2010 (for Windows). -- Best regards, Ivan
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