Change aesthetics conditional_effects

Hi,

For starters I’d recommend reading through the ?conditional_effects help very carefully. Every time I revisit it I find some new tidbit that helps me plot my model output.

In your case, I would try something like this:

#creating conditional effects object
c_eff <- conditional_effects(example, categorical = T))

#creating plot
ugly_plot <- plot(c_eff, plot = FALSE)[[1]] + 

#at this point you have a ggplot object to work with
#put whatever fill & colors you want here, or anything else!
scale_fill_manual(values = c("1"= "green", 
                             "2"= "#7570b3", 
                             "3"= "#1b9e77",
                             "4" = "grey20",
                             "5" = "blue",
                             "6" = "grey80")) +
scale_color_manual(values = c("1"= "black", 
                      "2"= "black", 
                      "3"= "orange",
                      "4" = "grey20",
                      "5" = "blue",
                       "6" = "grey80")) +
theme_bw()

ugly_plot

and also take a look at Geom_point in marginal_effects where I was helped with a similar issue. The inherit.aes = FALSE can be critical for some plotting features.

2 Likes