JMarcelino
JMarcelino

Reputation: 984

sjPlot - plot_model() change points color and lines [R]

I have a lmer model and want to plot the effect trend with the point data, but the function plot_model(), although is great at plotting what I want, seems very unflexible in terms of customization.

I want to change the colours and alpha of the points in the following plot:

model1<-lmer(NDVI~ fall_ai+spring_ai+SI+(1|colony),data=clm,REML=T)
plot_model(model1, type = "pred", show.data = T)

enter image description here As well as change the CI lines from alpha colour to dashed lines, like the example below:

enter image description here How can I do it?

Upvotes: 0

Views: 3315

Answers (1)

JMarcelino
JMarcelino

Reputation: 984

A workaround can be using lattice to do it:

plot(Effect(c("fall_ai"),model1),
     colors="black",lwd=1.5,ylab="Spring NDVI",xlab="Autumn Aridity Index",
     ci.style="lines",main="",ylim=c(0.20,0.55),xlim=c(0,45))

trellis.focus("panel", 1, 1, highlight = FALSE)
print(panel.points(clm$fall_ai,pch = 16, cex = 0.7, col = "black"))
trellis.unfocus()

Upvotes: 0

Related Questions