Search code examples
rplotcorrelation

corrplot: Changing to times new roman corrplot() output


I've like to create an image using corrplot() function in corrplot package in times new roman without success. I try to use par(family="Times"), but doesn't work and in help of the function don't have font type control. I try to make:

library(corrplot)
data(mtcars)
M <- cor(mtcars)
## plot
par(family="Times")
corrplot(M, method = "number", col = "black", cl.pos = "n")
#

Please, any ideas? Thanks


Solution

  • I'm not sure it will work but I think this post will help you :

    Changing fonts in ggplot2

    It will not help you but it is a really good post on font for R so I leave it on my answer.

    Are you on windows or unix ? If you are on windows this following answer will help you, if not I don't know.

    The problem is just coming from the fact that you are using Times wherease it is Times New Roman needed.

    You can check it with the following line of code :

    windowsFonts()
    par(family="Times New Roman")
    corrplot(M, method = "number", col = "black", cl.pos = "n")
    

    In fact TT is the first letter of TrueType and it is common for all fonts. If you want a specific font you should not use TT. See :

    https://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/windowsFonts.html