0

I have problems coloring the two levels of my predictor variable (group) when using plot_model, if I am just plotting one of the variables. Here is an example of that, where both groups are just black lines:

library(sjPlot)

n <- 30
dat <- data.frame(  group=rep(LETTERS[1:2], n/2),
                  age=sample(18:30, n, replace=TRUE),
                  x=rnorm(n))

m <- lm(x ~ group + age, data=dat)

plot_model(m, type = "eff", terms = c("group"), colors=c("red", "blue"))

If I plot the second variable along with it, it colors the levels of that, however:

plot_model(m, type = "eff", terms = c("group", "age"), colors=c("red", "blue"))

How can I apply the colors to the levels of "group" when only plotting the predicitions for this variable?

Thanks!

BRB
  • 25
  • 4

0 Answers0