R图形中的乳胶字符?

Latex character in R graphics?

我学会了latex来写报告和论文。我更多地使用 R 来处理图形。我想知道:有没有办法改变 R 图中的字体,使它们看起来更 "latex-like"?我想将这些图表包含在乳胶文档中。谢谢!

有一些很好的 R 和 Tex 库,但如果您想要更改字体,您应该查看库(extrafont)

例如,如果您想在绘图中使用 Garamond,您可以这样做:

library(extrafont)

pdf("plot_garamond.pdf", family="Garamond", width=4, height=4.5)

plot(mtcars$mpg, mtcars$wt, 
 main = "Fuel Efficiency of 32 Cars",
 xlab = "Weight (x1000 lb)",
 ylab = "Miles per Gallon")

dev.off()

更多信息请访问 http://blog.revolutionanalytics.com/2012/09/how-to-use-your-favorite-fonts-in-r-charts.html

库说明位于 http://cran.r-project.org/web/packages/extrafont/extrafont.pdf