diff --git a/NEWS.md b/NEWS.md index 1ef86a53..bf6aaef8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ * Fixed test in `test-ppc-distributions.R` that incorrectly used `ppc_dens()` instead of `ppd_dens()` when testing PPD functions * New functions `mcmc_dots` and `mcmc_dots_by_chain` for dot plots of MCMC draws by @behramulukir (#402) * Default to `quantiles=100` for all dot plots by @behramulukir (#402) +* Use `"neff_ratio"` consistently in diagnostic color scale helpers to avoid relying on partial matching of `"neff"`. # bayesplot 1.15.0 diff --git a/R/mcmc-diagnostics.R b/R/mcmc-diagnostics.R index f363026d..2a71b8e0 100644 --- a/R/mcmc-diagnostics.R +++ b/R/mcmc-diagnostics.R @@ -255,8 +255,8 @@ mcmc_neff <- function(ratio, ..., size = NULL) { linetype = 2, linewidth = 0.25) + labs(y = NULL, x = expression(N[eff]/N)) + - scale_fill_diagnostic("neff") + - scale_color_diagnostic("neff") + + scale_fill_diagnostic("neff_ratio") + + scale_color_diagnostic("neff_ratio") + scale_x_continuous( breaks = breaks, # as.character truncates trailing zeroes, while ggplot default does not @@ -287,8 +287,8 @@ mcmc_neff_hist <- function(ratio, ..., binwidth = NULL, bins = NULL, breaks = NU binwidth = binwidth, bins = bins, breaks = breaks) + - scale_color_diagnostic("neff") + - scale_fill_diagnostic("neff") + + scale_color_diagnostic("neff_ratio") + + scale_fill_diagnostic("neff_ratio") + labs(x = expression(N[eff]/N), y = NULL) + dont_expand_y_axis(c(0.005, 0)) + yaxis_title(FALSE) + @@ -424,12 +424,12 @@ diagnostic_points <- function(size = NULL) { # Functions wrapping around scale_color_manual() and scale_fill_manual(), used to # color the intervals by rhat value -scale_color_diagnostic <- function(diagnostic = c("rhat", "neff")) { +scale_color_diagnostic <- function(diagnostic = c("rhat", "neff_ratio")) { d <- match.arg(diagnostic) diagnostic_color_scale(d, aesthetic = "color") } -scale_fill_diagnostic <- function(diagnostic = c("rhat", "neff")) { +scale_fill_diagnostic <- function(diagnostic = c("rhat", "neff_ratio")) { d <- match.arg(diagnostic) diagnostic_color_scale(d, aesthetic = "fill") }