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.
I corresponded with @pmur002 about this some time back - as far as we can tell the pdf is being written correctly (i.e. it contains a don't interpolate flag), and it's the viewer that's buggy.
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
ingeom_raster
, and regardless of the value I set fordpi
, and various arguments topdf
likecompress
andonefile
. 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.
Code
SessionInfo:
Files
https://cloud.githubusercontent.com/assets/843017/17610634/d981671a-600d-11e6-8211-b23fc216dda9.png
https://github.com/hadley/ggplot2/files/414529/Rplot.pdf
The text was updated successfully, but these errors were encountered: