无法更改ggplot/geom_text中的字体 [英] Can't change fonts in ggplot/geom_text
本文介绍了无法更改ggplot/geom_text中的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法在geom_text中设置字体.这是我尝试过的:
I can't set my fonts in geom_text. Here is what I tried:
labels_test<-data.frame(a=c("a","b","c"),b=c(1:3),c=c(3:1))
# works
ggplot () + geom_text(data=labels_test,aes(b,c,label=a),color="blue")
# does not work:
ggplot () + geom_text(data=labels_test,aes(b,c,label=a),color="blue",family="Times")
# error message: In grid.Call.graphics(L_text, as.graphicsAnnot(x$label), x$x, x$y,:
# Font family not found in Windows font database
我已经按照指示导入了所有字体.这里.有什么想法出了什么问题吗?
I already imported all fonts as indicated here. Any ideas what is still going wrong?
推荐答案
我会尝试"
windowsFonts(Times=windowsFont("TT Times New Roman"))
在执行此操作时,您明确指定Windows字体映射.
In doing this your specifying explicitly the Windows Font mapping.
这篇关于无法更改ggplot/geom_text中的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文