Bayesplot mcmc_areas line and grid width manipulation

Short summary of the problem
Trouble changing ridgeline width of posterior density plots drawn with mcmc_areas command

I’m not so sure if this is the right place to ask this question but here it goes:

I am using the mcmc_areas() command in the bayesplot package to generate a posterior density plot for an article. I initially had little trouble using it, but I ran into some trouble when I tried to print it in high resolution as requested by the journal. I could adjust the font size easily using ggplot2, but I couldn’t figure out a way to adjust the line width of the outer ridge line. Is there an easy way to do this while still using the package? Or I’m more generally wondering how other people are generating high-resolution plots with mcmc_areas while not running into overly thin or think ridgelines…

I have something like this, using a brmsfit object:

posterior <- as.array(brm_object)
posterior <- posterior[ , , 5:8 ]
dimnames(posterior)[[3]] <- c("var1",
v3 <- mcmc_areas(
  pars = c("var1",
  prob = 0.90,
  prob_outer = 0.95,
  point_est = "mean"
)+ theme(axis.text=element_text(size=10, color = "black", family = "Helvetica"))

Please forgive the noob question. I’d appreciate any advice.

Operating System: Windows 10
Interface Version: R3.6.3

Definitely a fine place to ask!

There’s not currently an argument to control the size of the ridgelines in the released version of bayesplot, but I made a branch on GitHub to try this out. If you do

devtools::install_github("stan-dev/bayesplot", ref = "ridgeline-size")

then that version of mcmc_areas will have an argument size that will let you increase or decrease the line thickness.

Does that give you what you needed? Let me know in case I misunderstood.

Amazing!! Thanks a bunch Jonah. It worked perfectly and the plot now looks much better. I’ll make sure to add the appropriate citations.

1 Like

Glad that worked! We’ll try to get this into the next release of bayesplot but in the meantime you can use the version you installed from GitHub.