Saved ggplot2 images different across machines


[Apologies - no idea of how to make a reproducible example of this...]

On a couple of occasions when saving ggplot2 objects (using ggsave()), images have appeared different when viewed on different machines.

For example:

Screenshot, when viewed on my Mac, with macOS Mojave 10.14.6

Screenshot of same image, when viewed on my collaborator's Windows PC, with Windows 10

(You will notice that the geom_ribbon()s have disappeared.)

This has happened previously, also with geom_ribbons().

Very grateful for any hints as to what might be going wrong, or how to overcome.


Plots will tend to look marginally different between different OSs, e.g. I use Windows and Linux and regardless of settings I cannot get png output to match identically.

As regards the ribbon, I have no explanation except to check you are running the identical code. If so, also check for the same package versions (although nothing springs to mind in ggplot2 regarding geom_ribbon).

Thanks so much.

Apologies - just to clarify, this is an image that has been produced in RStudio on my machine, saved as .pdf using ggsave() then emailed to a colleague, who couldn't see the ribbons on their machine... so they are not running the code. Has happened on a few occasions now.

Ah, I should have read your issue more carefully.

The only thing that comes to mind is to use the cairo device:
ggsave(..., filename = "name.pdf", ..., device = cairo_pdf)

That's a pure guess though, but worth trying.

That is good suggestion - thanks! I will try this.

Would be interested to know whether others have encountered similar issue?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.