I love the plots that ggplot generates. However, it is still somewhat cumbersome to get publication quality plots directly. I usually have to do some post processing in Illustrator (i.e. changing fonts, numbering figures etc). While I could save as tiff or png, eps is best for manipulating figures in Illustrator (I can ungroup objects, move the legend/text etc).
When I save a ggplot object with some transparency (either in points or a smoother) I get this error:
Warning message: In grid.Call.graphics("L_points", x$x, x$y, x$pch, x$size) : semi-transparency is not supported on this device: reported only once per page
Is there a workaround?
The plot can be saved in the eps format using the ggplot. save() method, which takes as argument the string name of the plot.
There is no option in Format pane to make the R visual background to be transparent. Only small part (around the R visual) can be transparent as below. But we should be able to set bg="transparent" to make it to be transparent like below. Could you please share your R scripts written in the R script editor?
You can either print directly a ggplot into PNG/PDF files or use the convenient function ggsave() for saving a ggplot. The default of ggsave() is to export the last plot that you displayed, using the size of the current graphics device. It also guesses the type of graphics device from the extension.
This works:
ggsave("filename.eps", device=cairo_ps)
I had the same issues with using the postscript
function. I found that cairo_ps
from the grDevices
package does support transparency (at least in Ubuntu 10.04 with R version 2.10.1). Usage would be:
cairo_ps(filename='filename.eps', width=7, height=7) plot(x,y) dev.off()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With