Fix legend border artifact in ppc_freqpoly#537
Fix legend border artifact in ppc_freqpoly#537utkarshpawade wants to merge 3 commits intostan-dev:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a ggplot2 legend rendering artifact in the posterior predictive check frequency polygon plots (ppc_freqpoly() and, transitively, ppc_freqpoly_grouped()), where the geom_area() outline color was bleeding into the legend key.
Changes:
- Add a
guides(fill = guide_legend(override.aes = list(color = NA)))override to suppress the outline color in the fill legend key forppc_freqpoly(). - Document the fix in
NEWS.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
R/ppc-distributions.R |
Overrides legend aesthetics for the fill guide to remove the unwanted border artifact in freqpoly PPC plots (also affects grouped variant via delegation). |
NEWS.md |
Adds a changelog entry describing the legend border artifact fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #537 +/- ##
=======================================
Coverage 99.15% 99.15%
=======================================
Files 35 35
Lines 5920 5921 +1
=======================================
+ Hits 5870 5871 +1
Misses 50 50 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jgabry
left a comment
There was a problem hiding this comment.
Thanks! I made one review comment. Also, do we have the same issue with ppd_freqpoly or just the ppc_ version?
| ) + | ||
| scale_fill_ppc() + | ||
| scale_color_ppc() + | ||
| guides(fill = guide_legend(override.aes = list(color = NA, alpha = 1))) + |
There was a problem hiding this comment.
I think we only need color=NA but not alpha = 1. If the user customizes the alpha level then it's ok if the legend uses that alpha level, we don't need to force it to 1.
Fixes #134
ppc_freqpoly()andppc_freqpoly_grouped()displayed a visible dark border around theylegend key due to thecoloraesthetic fromgeom_area()bleeding into the legend glyphguides(fill = guide_legend(override.aes = list(color = NA)))to suppress the outline color in legend keysBefore

After
