当使用{effects}包绘制“效应”图时,我无法更改字体类型为Times New Roman。在其他绘图中(基本或ggplot),我使用{extrafont}包,这对我很有效 - 但我无法解决此处的设置问题,因为需要遵守期刊准则。
以下是最小可再现示例:
以下是最小可再现示例:
library(extrafont)
loadfonts(device="win")
windowsFonts(Times=windowsFont("TT Times New Roman"))
#
require(effects)
mod.cowles <- glm(volunteer ~ sex + neuroticism*extraversion,
data=Cowles, family=binomial)
eff.cowles <- allEffects(mod.cowles, xlevels=list(extraversion=seq(0, 24, 6)))
# Sample plot, yet I need all text to be Times New Roman
plot(eff.cowles$sex)
#
# This, however, does not change the font as expected...
plot(eff.cowles$sex, family = "Times New Roman" )
#
# Just for comparison - here, the fonts (title, axes, etc.) change properly
hist(Cowles$neuroticism, family = "Times New Roman")
也许我错过了某些简单的东西,但是无法解决这个问题。非常感谢您提供任何建议。