rpdfggplot2ggsave

Saving ggplots with greek alphabets in pdf


Here is a minimal example of the problem I face:

data.frame(Time=as.factor(c(0,5,10,15,20,25,30,35)),
               Value=c(0,2,4,6,8,6,5,6))%>%
  ggplot(aes(x=Time,y=Value))+
  geom_point()+
  ylab("\U0394 O.D")
ggsave("image.pdf", dpi = 1200)

I am able to generate a plot which renders the delta perfectly. However, the last command to save the plot as a PDF gives warnings. When you open the saved file, the y-axis is labelled as ..OD.


Solution

  • Try to use Cairo:

    ggsave("image.pdf", dpi = 1200, device = cairo_pdf)