Mcmc_parcoord()

Hi folks !

I’m a big fan of mcmc_parcoord() for looking at divergences, as recommended here.

My superficial question is how to avoid the parameter labels getting cut off like below from the documentation ?

Thank you !

1 Like

Hey Shira,

We should fix this in bayesplot but in the meantime you can use ggplot2::expand_limits(). For example:

x <- example_mcmc_draws(params = 5)

# expand x-axis limit to just greater than number of parameters
mcmc_parcoord(x) + ggplot2::expand_limits(x = 5.5) 

Another option that I’ve been using more recently is to flip the plot using mcmc_parcoord(x) + ggplot2::coord_flip(), which also usually makes it easier to visualize a greater number of parameters.

2 Likes

I just opened a PR on GitHub to fix this, so if you want you can try installing that branch of bayesplot instead of using the code in my previous response:

devtools::install_github("stan-dev/bayesplot", ref = "mcmc_parcoord-expand_limits")
3 Likes

hooray ! thank you so much, this is perfect.

1 Like