3

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

Leprechault
  • 1,531
  • 12
  • 28

1 Answers1

3

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

Rémi Coulaud
  • 1,684
  • 1
  • 8
  • 19
  • Doen't work, when I make: library(extrafont) loadfonts(device = "win") library(corrplot) data(mtcars) M <- cor(mtcars) ## plot corrplot(M, method = "number", col = "black", cl.pos = "n", family="TT Times New Roman") # – Leprechault May 28 '19 at 15:21
  • The code above alone on my windows computer works and you ? – Rémi Coulaud May 28 '19 at 15:32