File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ mcmc_rank_overlay <- function(x,
266
266
pars = character (),
267
267
regex_pars = character (),
268
268
transformations = list (),
269
+ facet_args = list (),
269
270
... ,
270
271
n_bins = 20 ,
271
272
ref_line = FALSE ) {
@@ -278,6 +279,7 @@ mcmc_rank_overlay <- function(x,
278
279
)
279
280
280
281
n_chains <- unique(data $ n_chains )
282
+ n_param <- unique(data $ n_parameters )
281
283
282
284
# We have to bin and count the data ourselves because
283
285
# ggplot2::stat_bin(geom = "step") does not draw the final bin.
@@ -314,12 +316,19 @@ mcmc_rank_overlay <- function(x,
314
316
} else {
315
317
NULL
316
318
}
317
-
319
+
320
+ facet_call <- NULL
321
+ if (n_param > 1 ) {
322
+ facet_args $ facets <- ~ parameter
323
+ facet_args $ scales <- facet_args $ scales %|| % " fixed"
324
+ facet_call <- do.call(" facet_wrap" , facet_args )
325
+ }
326
+
318
327
ggplot(d_bin_counts ) +
319
328
aes_(x = ~ bin_start , y = ~ n , color = ~ chain ) +
320
329
geom_step() +
321
330
layer_ref_line +
322
- facet_wrap( " parameter " ) +
331
+ facet_call +
323
332
scale_color +
324
333
ylim(c(0 , NA )) +
325
334
bayesplot_theme_get() +
You can’t perform that action at this time.
0 commit comments