Short summary of the problem
I had a question when I plotting brms fit
family = gaussian(link="identity"),
control = list(adapt_delta=0.97,max_treedepth = 15,stepsize=0.001)
fit<-conditional_effects(fit_openness,effect=“date:canopy”,re_formula = NA)
then I got a figure like this
question.pdf (19.8 KB)
I want to adjust the interval between the red points and blue points, and maybe do other adjustments just like theme, font, etc. How can I do this?
thank you very much!
A reproducible example:
mtcars2 <- mtcars; mtcars2$cyl <- factor(mtcars$cyl); mtcars2$am <- factor(mtcars2$am)
model <- brm(qsec ~ cyl*am, data = mtcars2, chains = 1, backend = 'cmdstanr')
cond <- conditional_effects(model, effect = 'cyl:am')
(p <- plot(cond, points=T))
These plots that
brms produces are returned in a list:
#  "list"
But each list entry is just a
#  "gg" "ggplot"
Theme adjustments etc. are easy enough, you can add things to these plots:
p[] + theme_minimal()
To make more involved changes, it’s probably easier to make your own plot instead. You can still use the
conditional_effects output, e.g. like so:
est <- as.data.frame(cond[])
aes(cyl, qsec, color = am),
aes(cyl, estimate__, ymin = lower__, ymax = upper__, color = am),
position = position_dodge(width = 1)
My problem was solved perfectly by your methods,
now I can adjust the brms data just like I adjust a normal ggplot2 data.
Thank you very much!