corrplot:更改为 times new roman corrplot() 输出

corrplot: Changing to times new roman corrplot() output

我想在 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")
#

拜托,有什么想法吗?谢谢

我不确定它是否有效,但我认为这个 post 会对你有所帮助 :

它不会帮助你,但它是一个非常好的 post R 字体,所以我把它留在我的答案中。

您使用的是 windows 还是 unix?如果您在 windows 上,以下答案将对您有所帮助,否则我不知道。

问题只是因为您正在使用 TimesTimes 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