Trying to achieve a predicting graph using sjPlot(type = "pred"), I was having issues with the coloring process and discover the following: the "color" argument does nothing on its own. It is only used if aes() is called afterwards.
(p1 = plot_model(fit, type = "pred", terms = "cyl", color="red"))
With aes() added:
(p1 = plot_model(fit, terms = "cyl", type = "pred",color="red")+aes(color=""))
Note that it works even if aes(color) has no value. It works the same way if there is an unrelated value in it (for example; with aes(color = "blue")
It works the same way with the argument "fill" which takes its value from sjPlot(color). From what I gather, sjPlot(color) gives its value to both aes(color) and aes(fill), which then have to be called, even if the aes() call makes no sense.
Some other examples with "fill":
(p1 = plot_model(fit, terms = "cyl", type = "pred",color="red",fill="blue")+aes(color="blue"))
sjPlot(fill) does nothing, as "fill" is not called by aes().
(p1 = plot_model(fit, terms = "cyl", type = "pred",color="red",fill="blue")+aes(color="",fill=""))
Here, sjPlot(fill) has no effect on the color. sjPlot(color) passes its value to both aes(color) and aes(fill).
I could go on, there are many weird related behaviors. An arising issue is that it doesn't seem possible to have two different values for "color" and "fill".
Trying to achieve a predicting graph using sjPlot(type = "pred"), I was having issues with the coloring process and discover the following: the "color" argument does nothing on its own. It is only used if aes() is called afterwards.
Example:
data("mtcars")
library(lme4)
fit = lmer(mpg ~ cyl + (1 | carb), data = mtcars)
First graph, "color" does nothing:
(p1 = plot_model(fit, type = "pred", terms = "cyl", color="red"))
With aes() added:
(p1 = plot_model(fit, terms = "cyl", type = "pred",color="red")+
aes(color=""))
Note that it works even if aes(color) has no value. It works the same way if there is an unrelated value in it (for example; withaes(color = "blue")
It works the same way with the argument "fill" which takes its value from sjPlot(color). From what I gather, sjPlot(color) gives its value to both aes(color) and aes(fill), which then have to be called, even if the aes() call makes no sense.
Some other examples with "fill":
(p1 = plot_model(fit, terms = "cyl", type = "pred",color="red",fill="blue")+
aes(color="blue"))
sjPlot(fill) does nothing, as "fill" is not called by aes().(p1 = plot_model(fit, terms = "cyl", type = "pred",color="red",fill="blue")+
aes(color="",fill=""))
Here, sjPlot(fill) has no effect on the color. sjPlot(color) passes its value to both aes(color) and aes(fill).I could go on, there are many weird related behaviors. An arising issue is that it doesn't seem possible to have two different values for "color" and "fill".