Export plot as pdf with a utf8 character

无人久伴 提交于 2019-12-01 10:46:46
user20650

EDIT

Follow up question: custom graphical device in sweave shows how to integrate this into a custom graphic device.


This seems to render using CairoPDF() frm the Cairo package using ubuntu14.04, R3.2.1.EDIT from Stephane in the comments: if CairoPDF() doesn't work, then try cairo_pdf().

Some sweave code (using Rstudio)

\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}

<<Export_plot, echo=FALSE>>=
library(Cairo)

CairoPDF("test.pdf")
par(mar=c(6,6,6,6))
ylab <- expression(paste("", bar(italic("\u2113")), "(",phi[0], "|", italic(list(x,y)), ")"))
plot(0,0, ylab=ylab, cex.lab=2)
invisible(dev.off())

@

%Plot
\includegraphics[width=6cm]{test.pdf}

\end{document}

This is the pdf output i get (note the resolution is rubbish as i have converted it to png via gimp)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!