I can produce and save in pdf a ggplot figure in .pdf, including semi-transparency (alpha):
library(ggplot2)
library(cowplot)
p <- qplot(Sepal.Length, Petal.Length, data = iris, color = Species, size = Petal.Width, alpha = 0.5)
save_plot("plot.pdf",p)
The figure is perfectly displayed in my laptop (Mac), both as an individual figure in pdf and embedded in a word document. However, I've painfully experienced over the years that semi-transparency in my figures is usually not displayed in others' computers, commonly when they see them embedded in a Microsoft office document. This is particularly painful when I have to make a presentation in front of an audience, and suddenly the figures of my Powerpoint presentation in the conference room's computer do not show anything, just a blank plot. This is also problematic if I submit a paper to a journal and I get an email from the editor saying my figures are not displaying anything in the Word document. As the figures look ok in my Mac, I don't have a way to find out if the figures are correct, except by explicitly asking someone else to review the documents included the figures.
I have tried a couple of workarounds I've found online, e.g.:
save_plot("plot.pdf",p, useDingbats=F)
Or
save_plot("plot.pdf",p, device = cairo_pdf, fallback_resolution = 1200
But I still get emails from collaborators saying they can't see the figures, and still experience some embarrassed moments in presentations when I can't make my point because figures are not showing anything.
How on Earth can I save my figures in pdf without loosing information? At this point I don't know if this issue is related to the way the figures are constructed in R, or an issue of Microsoft Office dealing with pdf figures with semi-transparency. The truth is that I don't see anybody else in my research network experiencing these issues.
FYI
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp
TRUE TRUE TRUE TRUE TRUE TRUE TRUE
sockets libxml fifo cledit iconv NLS profmem
TRUE TRUE TRUE TRUE TRUE TRUE TRUE
cairo ICU long.double libcurl
TRUE TRUE TRUE TRUE