Reputation: 41
Does anyone know how to add a figure caption using sjPlot?
This is the code I have and I've tried multiple ways to add a figure caption, but has not been successful.
plot_model(mm1,type="pred", title = "Random Intercept and Fixed Slope", terms=c("l.carb","mfr"), pred.type="re")
Thanks in advance!
Upvotes: 1
Views: 562
Reputation: 13843
As the object created by sjPlot::plot_model()
is a ggproto
object, you can interact with the output the same as if you made a plot using ggplot()
. Use labs()
and reference caption=
. Note that you can also use this to overwrite any of the existing labels created by plot_model()
(like the title, axis labels, etc...).
Here, I modified the first example shown on the sjPlot reference.
library(sjmisc)
data(efc)
efc <- to_factor(efc, c161sex, e42dep, c172code)
m <- lm(neg_c_7 ~ pos_v_4 + c12hour + e42dep + c172code, data = efc)
# simple forest plot
p <- plot_model(m)
p + labs(caption='This is my caption')
Upvotes: 1