形式参数“ ylab”与多个实际参数匹配

时间:2019-09-22 17:53:18

标签: r plot

我正在尝试向我的Y轴添加标签。但是在这种情况下,我不知道如何处理。

inter <- interactionMeans(m2)
inter
plot(inter, traces=c("Sentence", "DV"), ylab="Probability of approval")

我遇到错误

 formal argument "ylab" matched by multiple actual arguments

plot without "ylab=..."

require(lme4)
library(phia)
require(tables)

m2 <- glmer(value ~ Sentence + DV + (Sentence * DV | lfdn) + (Sentence *  DV | le_nr), data = dw_1,
        family = binomial, control = glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun=1e8)))

inter <- interactionMeans(m2)
inter
plot(inter, traces=c("Sentence", "DV"), ylab="Probability of approval")

错误:

Fehler in matplot(means, type = type, pch = pch, axes = FALSE, xlab = "",  : 
  formales Argument "ylab" passt zu mehreren gegebenen Argumenten

1 个答案:

答案 0 :(得分:1)

出现错误的原因是plot.interactionMeans()不包含ylab参数。这是可以理解的,因为y标签只是原始模型中IV的名称,如果要更改其名称,可以在此处进行。但是,如果您想在y轴标签下方的较低空白处添加标题,这似乎是您想要的标题,则可以使用mtext()轻松地做到这一点。与缺少的ylab相比,令人沮丧的是,它们对绘图边距(par(c("mar", "oma"))进行了硬编码,因此与狭窄空间无关。

library(phia)

data(Adler)
mod.adler <- lm(rating ~ instruction * expectation, data=Adler)
means.adler <- interactionMeans(mod.adler)

plot(means.adler, abbrev.levels=TRUE)
mtext("Experimenter pre-conditioning", 1, at=par("usr")[1])

enter image description here