【问题标题】:CM Roman font in ggplotggplot中的CM罗马字体
【发布时间】:2020-04-14 02:06:56
【问题描述】:

因为我不能在 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 是其中一种字体。

【问题讨论】:

    标签: r ggplot2 extrafont


    【解决方案1】:

    字体可能尚未注册。先运行这个然后再试一次:

    library(extrafont)
    font_install('fontcm')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-16
      相关资源
      最近更新 更多