You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below creates a simple raster with 18 sharply-defined cells. If I ggsave it as a .png, I get a file that always renders correctly:
But if I save it as a .pdf, I get different behavior in different viewers. In Google Chrome, it renders like the .png. But in Apple Preview, it looks like this screenshot:
I get this behavior even if I explicitly set interpolate=FALSE in geom_raster, and regardless of the value I set for dpi, and various arguments to pdf like compress and onefile. I also get the same behavior if I "save as PDF" from the RStudio GUI.
I don't speak PDF/postscript, so I'm not sure how to diagnose this, but I'd be happy to provide additional information if for some reason this isn't reproducible on your machine.
On the other hand, if you think it would be useful, I'd be happy to write a PR that adds a line to ?geom_raster describing the issue and the geom_tile workaround so that nobody else wastes your time with this.