Changing color of stan_dens plot

Hi all,

I’m trying to change the color of the density plot. Here is my code

<<echo=FALSE,message=FALSE>>=
library(egg)
library(gridExtra)
stanplot <- stan_plot(myfit, pars=c("alpha","beta1","sigma"))
stantrace <- stan_trace(myfit,inc_warmup=FALSE, pars=c("alpha","beta1","sigma"))
standens <- stan_dens(myfit, pars=c("alpha","beta1","sigma"))
  standens2 <- standens + ggplot2::scale_color_manual(values = c("black"))
stanac <- stan_ac(myfit, pars=c("alpha","beta1","sigma"))
stanac <- stanac + theme(axis.title.y=element_blank())
ggarrange(plots=list(stantrace,standens2,stanac),nrow=3,
          widths = list(unit(5,'in'), unit(5, 'in')),
          labels=c('Trace Plot','Density Plot','Autocorrelation Plot'))
@

Nothing is changing and I’m still getting that beautiful read stan color. No error messages either.

Thanks

David

For stan_dens the colour is controlled by fill:

library(rstan)

fit <- stan_demo("eight_schools")
stan_dens(fit)
stan_dens(fit, fill = "black")
1 Like