Skip to content

Remove y-axis line from density, histogram, and dot plots#423

Open
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade:remove-y-axis-line
Open

Remove y-axis line from density, histogram, and dot plots#423
utkarshpawade wants to merge 2 commits intostan-dev:masterfrom
utkarshpawade:remove-y-axis-line

Conversation

@utkarshpawade
Copy link

This PR removes the y-axis line from plots where the y-axis has no meaningful scale, addressing the inconsistency noted in #418.

Changes

  • Added theme(axis.line.y = element_blank()) to 13 functions across 3 files
  • Functions affected: mcmc_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_freqpoly
  • Follows the same pattern already used in mcmc_dots()
  • Updated all visual regression test snapshots (51 files)
  • Added entry to NEWS.md

Testing

  • All 1387 tests pass
  • Visual regression tests updated and verified - y-axis line successfully removed
  • No functional changes to plot data or calculations

Fixes #418

- 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
Copilot AI review requested due to automatic review settings February 24, 2026 12:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove y-axis for plots where y-axis has no purpose

2 participants