0

I'm trying to save a plot from ggplot2. I'm trying two methods:

tiff('path/plot.tiff', units="in", width=8, height=5, res=300)
dev.off()

and

ggsave('test.tiff', device = 'tiff', units = 'in', width=8, height=5)

But ggsave add "gradient" in the plot. Do You know how can I get the same result as in tiff approach?

ggsave:

ggsave

tiff:

tiff

  • `.tiff` is a raster (pixelated) format, which might introduce artifacts like that. – r2evans Jul 06 '23 at 20:48
  • But any other format using ggsave produces this kindsof artefacts. Is there any other format which should deal with this? – Krzyztopher Jul 07 '23 at 01:06
  • vector formats such as `pdf` should be fine; if you aren't (as) familiar with the distinction between vector and raster, https://superuser.com/q/16434/402193 might help; in R, `pdf` is likely the most common vector-based format for rendering images, though `svg` (and, with more packages, `emf`) is another option. – r2evans Jul 07 '23 at 01:27
  • 1
    I've had success with higher quality saves using the `ragg` graphics device. You would need to `install.packages("ragg")` and then use `device = "agg_tiff"` in the `ggsave()` call. – Gregor Thomas Jul 07 '23 at 01:50
  • Thank You guys for all your advice. PDF from @r2evans looks better but still, this "gradient" effect occurs. The ragg method gives me the same output as ggsave(device='tiff'). Generally, my plot comes from multiple geom_point, and this gradient is between points. My main problem is that tiff() method can't generate some Unicode symbols (like U+229E), but ggsave() can. But end up with this gradient. – Krzyztopher Jul 07 '23 at 03:23

0 Answers0