About saving a figure to PDF with delta symbol

71 views
Skip to first unread message

lily li

unread,
Jan 26, 2018, 5:10:15 PM1/26/18
to ggp...@googlegroups.com
Hi ggplot users,

I have a problem about exporting a figure. There are ‰ symbols in the x- and y-axes. When exporting as pdf format, the symbols become "..." sign. I did a search and tried ggsave(), quartz() or cairo_pdf(), but it does not help. Could anyone tell me how to save as pdf format but also maintain the symbol? Thanks a lot.

Brandon Hurr

unread,
Jan 26, 2018, 8:56:18 PM1/26/18
to lily li, ggplot2
Lily,

Here is a nice blog post about using the different devices with special fonts. But using your millipercent symbol isn't so bad.

library(tidyverse)

pdf("test.pdf")
ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() + labs(x= "blah‰", y = "blah2‰")
dev.off()


ggplot(mtcars, aes(x = mpg, y = wt)) + geom_point() + labs(x= "blah‰", y = "blah2‰")

ggsave(filename = "cairo.pdf", device = cairo_pdf)
ggsave(filename = "normal.pdf")
ggsave("png.png")

yields the attached pdfs and png.

The normal pdf does what you say, but both the png and the cairo pdf does what you want.

I am on a mac so this is expected behavior. If you are on windows or linux you might need further guidance.

If you run the previous, what do you get? Where are you struggling?

Brandon



On Fri, Jan 26, 2018 at 2:10 PM, lily li <choc...@gmail.com> wrote:
Hi ggplot users,

I have a problem about exporting a figure. There are ‰ symbols in the x- and y-axes. When exporting as pdf format, the symbols become "..." sign. I did a search and tried ggsave(), quartz() or cairo_pdf(), but it does not help. Could anyone tell me how to save as pdf format but also maintain the symbol? Thanks a lot.

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

cairo.pdf
normal.pdf
png.png
Reply all
Reply to author
Forward
0 new messages