diff --git a/NEWS.md b/NEWS.md index bf6aaef8..31d9ef85 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,6 +11,7 @@ * 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"`. +* Replace `geom_density_ridges(stat = "identity")` with `geom_ridgeline()` in `mcmc-intervals.R` and `mcmc-distributions.R` since density is pre-computed; also drop redundant `stat = "identity"` from `geom_ridgeline()` calls. # bayesplot 1.15.0 diff --git a/R/mcmc-distributions.R b/R/mcmc-distributions.R index 54f90ff8..86c35ae8 100644 --- a/R/mcmc-distributions.R +++ b/R/mcmc-distributions.R @@ -323,9 +323,8 @@ mcmc_dens_chains <- function( group = interaction(.data$chain, .data$parameter) ) + geom_line(data = line_training) + - ggridges::geom_density_ridges( + ggridges::geom_ridgeline( aes(height = .data$density), - stat = "identity", fill = NA, show.legend = FALSE ) + diff --git a/R/mcmc-intervals.R b/R/mcmc-intervals.R index 1d505fdb..81bf943b 100644 --- a/R/mcmc-intervals.R +++ b/R/mcmc-intervals.R @@ -551,8 +551,7 @@ mcmc_areas_ridges <- function(x, args_inner <- list( mapping = aes(height = .data$density, color = .data$color, fill = .data$fill), data = dplyr::bind_rows(this_par_data, next_par_data), - scale = scale, - stat = "identity") + scale = scale) if (!is.null(border_size)) { args_inner$linewidth <- border_size diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg index 181537b0..cbf23ff6 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-default.svg @@ -20,106 +20,106 @@ - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - -0 -0.1 -0.25 -0.5 -0.75 -1 -N + + + + + + + + +0 +0.1 +0.25 +0.5 +0.75 +1 +N e f f - -N - - - - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff (default) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg index fc1bfeae..8c2fe3e6 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-binwidth.svg @@ -20,131 +20,131 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 + +0.00 +0.25 +0.50 +0.75 1.00 - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -N + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +N e f f - -N - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff_hist (binwidth) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg index 7ae79007..89485ae3 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-hist-default.svg @@ -20,158 +20,158 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.00 -0.25 -0.50 -0.75 + +0.00 +0.25 +0.50 +0.75 1.00 - - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -N + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +N e f f - -N - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff_hist (default) diff --git a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg index a3a9b2ba..17467d2c 100644 --- a/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg +++ b/tests/testthat/_snaps/mcmc-diagnostics/mcmc-neff-missing-levels.svg @@ -20,74 +20,74 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - -0 -0.1 -0.25 -0.5 -0.75 -1 -N + + + + + + + + +0 +0.1 +0.25 +0.5 +0.75 +1 +N e f f - -N - - - - - - -N -e -f -f - -N - -0.1 -N -e -f -f - -N - -0.5 -N -e -f -f - -N -> -0.5 + +N + + + + + + +N +e +f +f + +N + +0.1 +N +e +f +f + +N + +0.5 +N +e +f +f + +N +> +0.5 mcmc_neff (missing levels) diff --git a/tests/testthat/_snaps/mcmc-distributions/mcmc-dens-chains-default.svg b/tests/testthat/_snaps/mcmc-distributions/mcmc-dens-chains-default.svg index b7712311..e63a429c 100644 --- a/tests/testthat/_snaps/mcmc-distributions/mcmc-dens-chains-default.svg +++ b/tests/testthat/_snaps/mcmc-distributions/mcmc-dens-chains-default.svg @@ -25,31 +25,31 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + -V2 -V1 - - +V2 +V1 + + diff --git a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg index 45fb70f8..4d4c3a36 100644 --- a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg +++ b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-default.svg @@ -242,11 +242,11 @@ -π -E -π -Δ -E +π +E +π +Δ +E mcmc_nuts_energy (default) diff --git a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg index 26ce37c8..f7eb3bef 100644 --- a/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg +++ b/tests/testthat/_snaps/mcmc-nuts/mcmc-nuts-energy-merged.svg @@ -74,10 +74,10 @@ π -E -π -Δ -E +E +π +Δ +E mcmc_nuts_energy (merged) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg index 9fdcc654..1a4bdfb3 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-default.svg @@ -72,23 +72,23 @@ 0.2 mean sd -T -= -( -mean -, - -sd -) +T += +( +mean +, + +sd +) -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_2d (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg index 9170f5b9..914f1e9a 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-2d-stat-size-alpha.svg @@ -76,23 +76,23 @@ 0.2 median mad -T -= -( -median -, - -mad -) +T += +( +median +, + +mad +) -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_2d (stat, size, alpha) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg index 16f1016d..a6c03998 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-default.svg @@ -56,18 +56,18 @@ 0.1 0.2 0.3 -T -= -mean - -T -( -y -p -r -e -d -) +T += +mean + +T +( +y +p +r +e +d +) ppd_stat (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg index 4a42b8a7..d87f232b 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-discrete-stat.svg @@ -51,18 +51,18 @@ 0.4 0.5 0.6 -T -= -prop0 - -T -( -y -p -r -e -d -) +T += +prop0 + +T +( +y +p +r +e +d +) ppd_stat (discrete, stat) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg index 67de54b5..a48bbd94 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-default.svg @@ -146,18 +146,18 @@ -T -= -mean +T += +mean -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_freqpoly_grouped (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg index 380125c6..5634658a 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-freqpoly-grouped-stat-facets-bw.svg @@ -123,18 +123,18 @@ -T -= -sum +T += +sum -T -( -y -p -r -e -d -) +T +( +y +p +r +e +d +) ppd_stat_freqpoly_grouped (stat, facets, bw) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg index 3aed9cd7..f885ae2c 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-default.svg @@ -209,18 +209,18 @@ -T -= -mean - -T -( -y -p -r -e -d -) +T += +mean + +T +( +y +p +r +e +d +) ppd_stat_grouped (default) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg index e075886f..2741e5eb 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-discrete-stat.svg @@ -93,18 +93,18 @@ 0.5 -T -= -prop0 - -T -( -y -p -r -e -d -) +T += +prop0 + +T +( +y +p +r +e +d +) ppd_stat_grouped (discrete, stat) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg index d06ddc1c..a17f4351 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-grouped-stat-facet-args-binwidth.svg @@ -137,18 +137,18 @@ -T -= -stats::var - -T -( -y -p -r -e -d -) +T += +stats::var + +T +( +y +p +r +e +d +) ppd_stat_grouped (stat, facet_args, binwidth) diff --git a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg index fbdcef60..ebbe2d6e 100644 --- a/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg +++ b/tests/testthat/_snaps/ppc-test-statistics/ppd-stat-stat-binwidth-freq.svg @@ -58,18 +58,18 @@ 1.1 1.2 1.3 -T -= -mad - -T -( -y -p -r -e -d -) +T += +mad + +T +( +y +p +r +e +d +) ppd_stat (stat, binwidth, freq)