Color transparency for conditional_effects in brms

Hello community,

Could someone advise if there is a way to change colours transparency in conditional_effects plot in brms package. So far, I cannot override default alpha by scale_alpha_manual. Any ideas?

conditions1=data.frame(species.m = c("Acer platanoides","Acer pseudoplatanus","Fagus sylvatica"), status.p=c("alive"))

plot(conditional_effects(fit3, method = "fitted", effects=c("ba_m2.c:species.p"), 
  conditions=conditions1, mean=TRUE), plot = T, points=T, rug=T, facet_args=nlist(facets="species.m"))[[1]]+
  theme(legend.position = "top")+scale_y_continuous(breaks=seq(0,7, by=1))+coord_cartesian(y=c(0,7))+
  scale_color_manual(values = c("Acer platanoides"="darkblue","Acer pseudoplatanus"="mediumslateblue","Fagus sylvatica"="deeppink3","Ulmus glabra"="yellow"))+
  scale_fill_manual(values = c("Acer platanoides"="darkblue","Acer pseudoplatanus"="mediumslateblue","Fagus sylvatica"="deeppink3","Ulmus glabra"="yellow"))+
  scale_alpha_manual(values = c("Acer platanoides"=0.1,"Acer pseudoplatanus"=0.1,"Fagus sylvatica"=0.1,"Ulmus glabra"=0.1))

Operating System: Windows 10
Interface Version: brms 2.14.0
Compiler/Toolkit:

The plot method for conditional effects has a bunch of arguments passed to ggplot2

  line_args = list(),
  cat_args = list(),
  errorbar_args = list(),
  surface_args = list(),
  spaghetti_args = list(),
  point_args = list(),
  rug_args = list(),

and I think you should be able to pass alpha in those lists. Does that let make the plot you’re looking for?

1 Like

Yes, it works! Thank you so much, you save me hours!

1 Like

Great, glad that worked!