From d8899ed6d847f1cf0b6749c1b2c855833d6b3ebf Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Fri, 10 Apr 2026 11:01:03 +0530 Subject: [PATCH 1/5] Fix legend border artifact in ppc_freqpoly and ppc_freqpoly_grouped --- NEWS.md | 1 + R/ppc-distributions.R | 1 + 2 files changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index fceb6a8f..2af3705f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # bayesplot (development version) +* Fixed legend border artifact in `ppc_freqpoly()` and `ppc_freqpoly_grouped()`. * `ppc_ecdf_overlay()`, `ppc_ecdf_overlay_grouped()`, and `ppd_ecdf_overlay()` now always use `geom_step()`. The `discrete` argument is deprecated. * Fixed missing `drop = FALSE` in `nuts_params.CmdStanMCMC()`. * Replace `apply()` with `storage.mode()` for integer-to-numeric matrix conversion in `validate_predictions()`. diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index 7ab9ffb8..8b988074 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -468,6 +468,7 @@ ppc_freqpoly <- ) + scale_fill_ppc() + scale_color_ppc() + + guides(fill = guide_legend(override.aes = list(color = NA))) + facet_wrap_parsed("rep_label") + bayesplot_theme_get() + force_axes_in_facets() + From 546f608ed6b615fd7b88a12e865149916425d91d Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Fri, 10 Apr 2026 11:18:58 +0530 Subject: [PATCH 2/5] Update vdiffr snapshots for ppc_freqpoly legend fix --- .../ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg | 4 ++-- .../_snaps/ppc-distributions/ppc-freqpoly-default.svg | 4 ++-- .../_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg index 5fb2acd0..95851dd4 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg @@ -172,9 +172,9 @@ - + - + y y r diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg index 7bbb5856..d45966b0 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg @@ -160,9 +160,9 @@ - + - + y y r diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg index 9baeaf05..25d69476 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg @@ -355,9 +355,9 @@ - + - + y y r From 4a4e1765bb65ea222d4ea3ba4984af67d76fb697 Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Fri, 10 Apr 2026 11:27:25 +0530 Subject: [PATCH 3/5] Also override alpha in legend keys for low-alpha freqpoly plots --- R/ppc-distributions.R | 2 +- .../ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index 8b988074..2456a0d1 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -468,7 +468,7 @@ ppc_freqpoly <- ) + scale_fill_ppc() + scale_color_ppc() + - guides(fill = guide_legend(override.aes = list(color = NA))) + + guides(fill = guide_legend(override.aes = list(color = NA, alpha = 1))) + facet_wrap_parsed("rep_label") + bayesplot_theme_get() + force_axes_in_facets() + diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg index 95851dd4..dac801a5 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg @@ -172,9 +172,9 @@ - + - + y y r From 7897fe2698ced3f23e170694fd0ed05f0f6eab2a Mon Sep 17 00:00:00 2001 From: Utkarsh Date: Wed, 15 Apr 2026 17:20:46 +0530 Subject: [PATCH 4/5] drop alpha=1 from legend override --- R/ppc-distributions.R | 2 +- .../ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/ppc-distributions.R b/R/ppc-distributions.R index 2456a0d1..8b988074 100644 --- a/R/ppc-distributions.R +++ b/R/ppc-distributions.R @@ -468,7 +468,7 @@ ppc_freqpoly <- ) + scale_fill_ppc() + scale_color_ppc() + - guides(fill = guide_legend(override.aes = list(color = NA, alpha = 1))) + + guides(fill = guide_legend(override.aes = list(color = NA))) + facet_wrap_parsed("rep_label") + bayesplot_theme_get() + force_axes_in_facets() + diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg index dac801a5..95851dd4 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg @@ -172,9 +172,9 @@ - + - + y y r From 7ea83e9865afd02dda0d7e6185a5c4d6ab2fca2c Mon Sep 17 00:00:00 2001 From: jgabry Date: Wed, 15 Apr 2026 15:01:24 -0600 Subject: [PATCH 5/5] Fix merge conflicts --- .../ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg | 4 ++-- .../_snaps/ppc-distributions/ppc-freqpoly-default.svg | 4 ++-- .../_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg index 6b4bd675..6b46679f 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg @@ -172,9 +172,9 @@ - + - + y y r diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg index aa45b98a..d99e44dd 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg @@ -160,9 +160,9 @@ - + - + y y r diff --git a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg index aa820572..0ced8561 100644 --- a/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg +++ b/tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg @@ -355,9 +355,9 @@ - + - + y y r