Skip to content

Commit 05800bd

Browse files
authored
Merge pull request #470 from utkarshpawade/fix-diagnostic-color-scale-match-arg
Make diagnostic color matching explicit for neff
2 parents bcf5ada + 4d335f2 commit 05800bd

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* Fixed test in `test-ppc-distributions.R` that incorrectly used `ppc_dens()` instead of `ppd_dens()` when testing PPD functions
1111
* New functions `mcmc_dots` and `mcmc_dots_by_chain` for dot plots of MCMC draws by @behramulukir (#402)
1212
* Default to `quantiles=100` for all dot plots by @behramulukir (#402)
13+
* Use `"neff_ratio"` consistently in diagnostic color scale helpers to avoid relying on partial matching of `"neff"`.
1314

1415
# bayesplot 1.15.0
1516

R/mcmc-diagnostics.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ mcmc_neff <- function(ratio, ..., size = NULL) {
255255
linetype = 2,
256256
linewidth = 0.25) +
257257
labs(y = NULL, x = expression(N[eff]/N)) +
258-
scale_fill_diagnostic("neff") +
259-
scale_color_diagnostic("neff") +
258+
scale_fill_diagnostic("neff_ratio") +
259+
scale_color_diagnostic("neff_ratio") +
260260
scale_x_continuous(
261261
breaks = breaks,
262262
# 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
287287
binwidth = binwidth,
288288
bins = bins,
289289
breaks = breaks) +
290-
scale_color_diagnostic("neff") +
291-
scale_fill_diagnostic("neff") +
290+
scale_color_diagnostic("neff_ratio") +
291+
scale_fill_diagnostic("neff_ratio") +
292292
labs(x = expression(N[eff]/N), y = NULL) +
293293
dont_expand_y_axis(c(0.005, 0)) +
294294
yaxis_title(FALSE) +
@@ -424,12 +424,12 @@ diagnostic_points <- function(size = NULL) {
424424

425425
# Functions wrapping around scale_color_manual() and scale_fill_manual(), used to
426426
# color the intervals by rhat value
427-
scale_color_diagnostic <- function(diagnostic = c("rhat", "neff")) {
427+
scale_color_diagnostic <- function(diagnostic = c("rhat", "neff_ratio")) {
428428
d <- match.arg(diagnostic)
429429
diagnostic_color_scale(d, aesthetic = "color")
430430
}
431431

432-
scale_fill_diagnostic <- function(diagnostic = c("rhat", "neff")) {
432+
scale_fill_diagnostic <- function(diagnostic = c("rhat", "neff_ratio")) {
433433
d <- match.arg(diagnostic)
434434
diagnostic_color_scale(d, aesthetic = "fill")
435435
}

0 commit comments

Comments
 (0)