Re: GGSAVE does not save a good version of my graph

Ralf Goertz via R-help <[email protected]> Fri, 24 Jul 2026 10:02:03 +0200
Newsgroups gmane.comp.lang.r.general
Message-ID <[email protected]>
Am Thu, 23 Jul 2026 20:18:38 +0000
schrieb "Sorkin, John" <[email protected]>:

> I am running R in RStudio. I am creating a graph, which I see in the
> plot window, and I use ggsave() to save a copy of the graph in a
> file. =

> =

> When I use look at the graph is RStudio's Plots window, the graph
> looks fine. When I click on the Plot window's export button, copy the
> plot to the clipboard and paste the graph into MS word, the graph
> looks fine. Please see first figure on attached MS word document.
> =

> When I copy and paste the .tiff file saved by ggsave, the graph looks
> bad. Second figure on the attached MS word document. I think the
> graphs is being exported improperly by ggsave. I would appreciate any
> suggestions for improving the quality of the graph produced by
> ggsave. =


I have found it to be better to use a device directly with ggsave (e.g,
device=3Dsvg). When saving to svg with device=3DNULL (the default) and
filename=3D"plot.svg" the result is poor as letter spacing is often
incorrect because the fontpaths will not be saved. With device=3Dsvg it
looks perfect. So something similar may happen with tiff (although of
course that is not a vector format). Since you embedded the figure in
Word why not use svg anyway? It finally is a supported format (it hasn't
always been). I hope that some day also pdf will be supported by Word.
(No, what I actually hope is that soon I won't have to use Word
anymore. =F0=9F=98=81)