Here’s some example code from a project I’m working on that should help you do what you’re trying to
# Uses packages tidyverse, brms, scales, and latex2exp
# Make the plot object
spagetti_plot <- plot(
conditional_effects(
zib_femleg_cond_fit_2,
effects = "time",
prob = 0.89,
spaghetti = TRUE
),
theme = theme_bw()
)
# You can make subsequent aesthetic tweaks by referencing the underlying ggplot2 object
spagetti_plot_edited <- spagetti_plot$time +
# Adjust the breaks along the y axis
scale_y_continuous(breaks = scales::pretty_breaks(n = 5)) +
# Adding Labels to the X and Y axis
labs(
y = TeX('Y | $\\alpha_{j}+\\gamma_{j}Time_{tj}\\times\\gamma_{j}Conflict_{tj}$'),
x = TeX("Time")
)
# Render the plot to a file instead of printing it to the viewer because spagetti plots tend to crash R Studio
ggsave(
filename = "Figure_1A.png",
plot = spagetti_plot_edited,
device = "png",
width = 16,
height = 10,
units = "in",
dpi = "retina",
type = "cairo",
limitsize = FALSE
)