Search code examples
rggplot2plotmcmc

Is there a way to use ggs_caterpillar to compare two models on the same facet, all parameters are shared?


I can produce a caterpillar plot using ggmcmc::ggs_caterpillar with two facets each one showing a model.

In this case all my parameters are shared between the models. I would like to plot them on the same facet. So I can visually compare each parameter next to each other with a small vertical offset.

Is this possible in the function or via another approach?

library(ggmcmc)
Model1 <- ggs(Model1MCMCOutput)
Model2 <- ggs(Model2MCMCOutput)

ggs_caterpillar(list(Model1, Model2))

Solution

  • This is not possible using this function. I looked in the internals and the plotting inside is done in a slightly convoluted way. I wrote my own function for plotting what I needed. Using geom_linerange and rotating the coordinate system rather than using geom_segment as in ggs_caterpillar.