Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request (or help): Use different colors for posterior draws for some parameters in mcmc_area() #280

Open
freshbeka opened this issue Nov 12, 2021 · 3 comments

Comments

@freshbeka
Copy link

I'd like to the color of a few specific variables in my mcmc_area() plot to be one color, while the rest are another color. Referencing your plot from the Posterior uncertainty intervals vignette, say I wanted only the pars = "cyl" posterior distribution in blue, and the rest ("drat", "am", "sigma"), still in red. Is this already possible and I'm failing to figure it out? Thank you for your beautiful and helpful package!

@freshbeka freshbeka changed the title Feature request (or help): Use different colors for some posterior draws in mcmc_area() Feature request (or help): Use different colors for posterior draws for some parameters in mcmc_area() Nov 12, 2021
@jgabry
Copy link
Member

jgabry commented Nov 12, 2021

Unfortunately I think the way the package is designed makes this quite difficult. If you're willing to do some more manual ggplot2 coding (as opposed to using the single functions provided by bayesplot), you could probably accomplish something similar to what you want using @mjskay's ggdist package. In general bayesplot is useful for providing simple function calls to get immediate feedback after fitting models (and provides some but not extensive customization ability), whereas a package like ggdist requires more coding but is much more powerful when it comes to the ability to customize the plots.

@freshbeka
Copy link
Author

Thank you for this guidance. For a workaround, I mimicked one of the vignette examples and added the 'rhat' call. I assigned fake r-hat values to each of my predictor variables of 1, 1.1, 1.3 according to category (I have 3 categories) and the call + legend_move("none"). It works well enough for now and I'll give ggdist a look so that I can make a cleaner plot with a legend when the time comes. Thank you!

@jgabry
Copy link
Member

jgabry commented Nov 12, 2021

For a workaround, I mimicked one of the vignette examples and added the 'rhat' call.

Great idea! That didn't even occur to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants