我想在 times new roman 中使用 corrplot 包中的 corrplot() 函数创建图像,但没有成功。我尝试使用 par(family="Times"),但不起作用,并且在该功能的帮助下没有字体类型控制。我尝试做:
library(corrplot)
data(mtcars)
M <- cor(mtcars)
## plot
par(family="Times")
corrplot(M, method = "number", col = "black", cl.pos = "n")
#
请问,有什么想法吗?谢谢
我不确定它是否有效,但我认为这篇文章会对您有所帮助:
它不会对你有帮助,但这是一篇关于 R 字体的非常好的帖子,所以我把它留在我的答案中。
你使用的是windows还是unix?如果您使用的是 Windows,下面的答案会对您有所帮助,如果不是,我不知道。
问题在于您正在使用
Times
,而需要Times New Roman
。
您可以使用以下代码行进行检查:
windowsFonts()
par(family="Times New Roman")
corrplot(M, method = "number", col = "black", cl.pos = "n")
事实上TT是TrueType的第一个字母,所有字体都通用。如果您想要特定字体,则不应使用 TT。参见:
https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/windowsFonts.html
“衬线”
library(corrplot)
data(mtcars)
M <- cor(mtcars)
par(family="serif")
corrplot(M, method = "number", col = "black", cl.pos = "n")