[R] GGSAVE does not save a good version of my graph
Ralf Goertz
r_goertz @end|ng |rom web@de
Fri Jul 24 10:02:03 CEST 2026
Am Thu, 23 Jul 2026 20:18:38 +0000
schrieb "Sorkin, John" <jsorkin using som.umaryland.edu>:
> 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=svg). When saving to svg with device=NULL (the default) and
filename="plot.svg" the result is poor as letter spacing is often
incorrect because the fontpaths will not be saved. With device=svg 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. 😁)
More information about the R-help
mailing list