1

因为我不能在 ggplot 中使用 CM roman。

这有效:

a <- ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +
  ggtitle("Fuel Efficiency of 32 Cars") +
  xlab("Weight (x1000 lb)") + ylab("Miles per Gallon") +
  theme(text=element_text(size=16,  family="Times New Roman"))
print(a)

但这并不

a <- ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point() +
  ggtitle("Fuel Efficiency of 32 Cars") +
  xlab("Weight (x1000 lb)") + ylab("Miles per Gallon") +
  theme(text=element_text(size=16,  family="CM Roman"))
print(a)

当我运行fonts()时,它告诉我 CM Roman 是其中一种字体。

4

1 回答 1

0

该字体可能尚未注册。首先运行它,然后再试一次:

library(extrafont)
font_install('fontcm')
于 2021-06-30T12:37:12.590 回答