Tweaking trace plots with bayesplot

Hello,
I’m wrapping up a case study, which uses cmdstanr. I’m trying to remove rstan depencies, by using bayesplots and posterior to do diagnostics. I have two outstanding problems with the trace plots.

  1. The chains are all a shade of blue, which makes it difficult to distinguish which trace corresponds to which chain.
  2. How can I added a shaded area to indicate which iterations are in the warmup phase and which ones are in the sampling phase?

Here’s the code for constructing the traceplots, using a cmdstanr fit object.

bayesplot::mcmc_trace(r_fit2$draws(), pars = pars)

@jonah

Hey Charles,

Yeah, the default color scheme isn’t ideal for the trace plots. In the Examples section at the bottom of help("mcmc_trace") there are examples of changing the color scheme to mix colors. For instance, try color_scheme_set("mix-blue-red") before running mcmc_trace().

Check out the n_warmup argument. It should shade however many iterations you tell it to.

Let me know if those suggestions don’t work out.