I’m doing some work with multivariate models and want to make a panel plot / facetted plot where each plot is a different outcome. I could not find anything in the existing options.
So a reprex:
library(brms) library(patchwork) data("BTdata", package = "MCMCglmm") head(BTdata) fit3 <- brm( mvbind(tarsus, back) ~ sex + hatchdate, data = BTdata, chains = 2, cores = 2 ) plotdata <- conditional_effects(fit3, "hatchdate") print(plotdata) # This gives me two separate plots:
However I want both plot as panels/facets in a single plot. At the moment I’m doing this fairly manually as follows:
g1 <- ggplot(plotdata$tarsus.tarsus_hatchdate, aes(x=hatchdate, y=estimate__)) + geom_line() + geom_ribbon(aes(ymin = lower__, ymax = upper__, linetype=NA), alpha=0.15) g2 <- ggplot(plotdata$back.back_hatchdate, aes(x=hatchdate, y=estimate__)) + geom_line() + geom_ribbon(aes(ymin = lower__, ymax = upper__, linetype=NA), alpha=0.15) g1 + g2
Ok this is what I want but I’m having to redo formatting work etc etc.
Is there any built in option for conditional_effects, or some other easy way to achieve this that I have missed?