I am trying to adjust the height and width of the output comprised of the plots of the posterior draws of multiple variables, using the mcmc_combo()
function (trace and density plots), as the size does not scale with the number of variables:
Code sample:
library(cmdstanr)
library(bayesplot)
library(dplyr)
draws <- fit2$draws(
variables = param[-5],
inc_warmup = TRUE,
format = "df"
)
pars <- grep("lam", names(draws), value = TRUE)
mcmc_combo(draws, pars = pars)
Output:
As the image shows, the graphs get too truncated to display the y-axis altogether.
I then tried plotting the variables one-by-one, using lapply()
:
lapply(pars, function(x) {mcmc_combo(draws, pars = x)})
As you can see, the plot window remains the same size, and the graph(s) are stretched to fit the window.
It would be better if I could fix the size of each individual graph, and have the plot window adapt to this instead. How can I accomplish this?