Skip to content

Commit e8e3d49

Browse files
committed
make nuts plots compatible with updates to grid graphics
1 parent 609b4ee commit e8e3d49

File tree

5 files changed

+5087
-5113
lines changed

5 files changed

+5087
-5113
lines changed

R/mcmc-diagnostics-nuts.R

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -224,20 +224,7 @@ mcmc_nuts_acceptance <-
224224
data = chain_scatter_data
225225
)
226226
}
227-
228-
nuts_plot <- gridExtra::arrangeGrob(
229-
hists,
230-
gridExtra::arrangeGrob(empty_grob()),
231-
gridExtra::arrangeGrob(
232-
empty_grob(),
233-
scatter,
234-
empty_grob(),
235-
ncol = 3,
236-
widths = c(1, 3, 1)
237-
),
238-
nrow = 3,
239-
heights = c(1, 0.1, 1)
240-
)
227+
nuts_plot <- gridExtra::arrangeGrob(hists, scatter, nrow = 2)
241228
as_bayesplot_grid(nuts_plot)
242229
}
243230

@@ -409,19 +396,10 @@ mcmc_nuts_treedepth <- function(x, lp, chain = NULL, ...) {
409396
chain_violin(violin_accept_stat_data, chain)
410397
}
411398

412-
nuts_plot <- gridExtra::arrangeGrob(
413-
gridExtra::arrangeGrob(
414-
violin_lp, violin_accept_stat,
415-
nrow = 1
416-
),
417-
gridExtra::arrangeGrob(
418-
empty_grob()
419-
),
420-
gridExtra::arrangeGrob(
421-
empty_grob(), hist_td, empty_grob(),
422-
ncol = 3, widths = c(1, 3, 1)
423-
),
424-
nrow = 3, heights = c(1, 0.1, 1)
399+
nuts_plot <- gridExtra::grid.arrange(
400+
gridExtra::arrangeGrob(violin_lp, violin_accept_stat, nrow = 1),
401+
hist_td,
402+
nrow = 2
425403
)
426404
as_bayesplot_grid(nuts_plot)
427405
}
@@ -572,7 +550,3 @@ chain_violin <-
572550
alpha = alpha
573551
)
574552
}
575-
576-
empty_grob <- function() {
577-
structure(list(), class = c("grob", "gDesc"))
578-
}

0 commit comments

Comments
 (0)