Remove y-axis line from density, histogram, and dot plots#423
Open
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
Open
Remove y-axis line from density, histogram, and dot plots#423utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
Conversation
- Add theme(axis.line.y = element_blank()) to remove unnecessary y-axis line - Affects mcmc_*, ppc_*, and ppd_* density/histogram/dot/violin/freqpoly functions - Follows the pattern already used in mcmc_dots() - Updates visual regression test snapshots to reflect changes - Updates NEWS.md with user-facing change description Fixes stan-dev#418
There was a problem hiding this comment.
Pull request overview
This PR updates bayesplot distribution-plot functions to remove the y-axis axis-line for plots where the y-axis is intentionally not meaningful (labels/ticks/title are already suppressed), and updates visual regression snapshots accordingly.
Changes:
- Added
theme(axis.line.y = element_blank())to multiple MCMC / PPC / PPD distribution plotting functions. - Updated visual regression SVG snapshots to reflect the removed y-axis line.
- Added a NEWS entry describing the visual change.
Reviewed changes
Copilot reviewed 4 out of 51 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| R/ppd-distributions.R | Removes y-axis axis-line for selected PPD distribution plots (overlay, dots, freqpoly). |
| R/ppc-distributions.R | Removes y-axis axis-line for key PPC distribution plots (dens overlay, dens, hist, freqpoly, dots). |
| R/mcmc-distributions.R | Removes y-axis axis-line via internal helpers affecting MCMC hist/dens/violin/dots families. |
| NEWS.md | Notes the visual change in the development NEWS. |
| tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-grouped-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-freqpoly-alpha-binwidth-size.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dots-quantile.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dots-quantile-binwidth.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dots-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dots-binwidth.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-bounds.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppd-dens-overlay-alpha-size.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-hist-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-hist-binwidth.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-grouped-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-freqpoly-alpha-binwidth-size.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dots-quantile.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dots-quantile-binwidth.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dots-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dots-binwidth.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-grouped-alpha-size.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-bounds.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dens-overlay-alpha-size.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/ppc-distributions/ppc-dens-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-violin-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-hist-freq.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-hist-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-hist-by-chain-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-hist-alpha.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-dens-overlay-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-dens-overlay-bounds.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-dens-default.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-dens-bounds.svg | Snapshot updated to reflect removed y-axis line. |
| tests/testthat/_snaps/mcmc-distributions/mcmc-dens-alpha.svg | Snapshot updated to reflect removed y-axis line. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes the y-axis line from plots where the y-axis has no meaningful scale, addressing the inconsistency noted in #418.
Changes
theme(axis.line.y = element_blank())to 13 functions across 3 filesmcmc_hist,mcmc_hist_by_chain,mcmc_dens,mcmc_dens_overlay,mcmc_violin,ppc_dens_overlay,ppc_dens,ppc_hist,ppc_freqpoly,ppc_dots,ppd_dens_overlay,ppd_dens,ppd_hist,ppd_dots,ppd_freqpolymcmc_dots()Testing
Fixes #418