我想使用 interactions
中的 interact_plot
函数绘制一个二元交互图。如何将字体大小更改为 Times New Roman?
这是我的代码:
interact_plot(Interac2, pred = SA, modx = RPF, alpha = .05, legend.main = "RP", x.label = "EXB", y.label = "NORCA")
jtools
中的interact_plot
。那里的文档说这个函数已经被弃用并移到了interactions
包中(我也把它编辑到了你的问题中)。查看GitHub上的源代码,显示最终对象是一个ggplot
对象。这很好,因为你可以在绘制后修改此对象的“主题”。你可以修改主题并重新绘制它,就可以得到想要的结果。interact_plot
的示例对我不起作用,但我确实成功地修改了其中一个。library(interactions)
library(extrafont)
loadfonts(device = "win")
fit <- lm(Income ~ HSGrad * Murder * Illiteracy, data = states)
xy <- interact_plot(model = fit, pred = Murder, modx = Illiteracy, mod2 = HSGrad)
xy + theme(axis.title = element_text(family = "serif"),
legend.text = element_text(family = "serif"),
legend.title = element_text(family = "serif"),
strip.text = element_text(family = "serif"))