Skip to content

Commit d6d5a62

Browse files
committed
Replace geom_density_ridges(stat=identity) with geom_ridgeline().
1 parent 906cd5c commit d6d5a62

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
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)
1313
* Use `"neff_ratio"` consistently in diagnostic color scale helpers to avoid relying on partial matching of `"neff"`.
14+
* 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.
1415

1516
# bayesplot 1.15.0
1617

R/mcmc-distributions.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,8 @@ mcmc_dens_chains <- function(
323323
group = interaction(.data$chain, .data$parameter)
324324
) +
325325
geom_line(data = line_training) +
326-
ggridges::geom_density_ridges(
326+
ggridges::geom_ridgeline(
327327
aes(height = .data$density),
328-
stat = "identity",
329328
fill = NA,
330329
show.legend = FALSE
331330
) +

R/mcmc-intervals.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -510,14 +510,13 @@ mcmc_areas_ridges <- function(x,
510510
args_outer <- list(
511511
mapping = aes(height = .data$density),
512512
color = get_color("dark"),
513-
fill = NA,
514-
stat = "identity"
513+
fill = NA
515514
)
516515
if (!is.null(border_size)) {
517516
args_outer$linewidth <- border_size
518517
}
519518

520-
layer_outer <- do.call(ggridges::geom_density_ridges, args_outer)
519+
layer_outer <- do.call(ggridges::geom_ridgeline, args_outer)
521520

522521
# Force ggridges to compute the scaling now
523522
test_plot <- ggplot(datas$outer) +
@@ -551,8 +550,7 @@ mcmc_areas_ridges <- function(x,
551550
args_inner <- list(
552551
mapping = aes(height = .data$density, color = .data$color, fill = .data$fill),
553552
data = dplyr::bind_rows(this_par_data, next_par_data),
554-
scale = scale,
555-
stat = "identity")
553+
scale = scale)
556554

557555
if (!is.null(border_size)) {
558556
args_inner$linewidth <- border_size

0 commit comments

Comments
 (0)