Skip to content

Commit abcbef1

Browse files
committed
Fix ggplot2 warning in mcmc_nuts_treedepth about dropping fewer than 2 observations.
1 parent 5a5b1e5 commit abcbef1

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

R/mcmc-diagnostics-nuts.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,15 @@ mcmc_nuts_treedepth <- function(x, lp, chain = NULL, ...) {
373373
ggplot(violin_lp_data, aes(x = factor(.data$Value), y = .data$lp)) +
374374
geom_violin(fill = get_color("l"), color = get_color("lh")) +
375375
labs(x = "treedepth__", y = "lp__") +
376+
scale_x_discrete(drop = FALSE) +
376377
bayesplot_theme_get()
377378

378379
violin_accept_stat_data <- data.frame(treedepth, as = accept_stat$Value)
379380
violin_accept_stat <-
380381
ggplot(violin_accept_stat_data, aes(x = factor(.data$Value), y = .data$as)) +
381382
geom_violin(fill = get_color("l"), color = get_color("lh")) +
382383
labs(x = "treedepth__", y = "accept_stat__") +
384+
scale_x_discrete(drop = FALSE) +
383385
scale_y_continuous(breaks = c(0, 0.5, 1)) +
384386
bayesplot_theme_get()
385387

0 commit comments

Comments
 (0)