Skip to content

feat(histogram): wrap default titles and allow custom titles - #434

Merged
georgezakinih merged 6 commits into
FNLCR-DMAP:devfrom
zhan4329:fix/histogram-text-clipping-spac
Nov 9, 2026
Merged

georgezakinih merged 6 commits into
FNLCR-DMAP:devfrom
zhan4329:fix/histogram-text-clipping-spac

Conversation

@zhan4329

@zhan4329 zhan4329 commented Nov 8, 2026 •

Copy link
Copy Markdown

Summary

This PR separates grouping or faceting details and any filtering information in the default Histogram titles with a line break. The shortening is intended to improve title readability in SPAC_Shiny, as described in SPAC_Shiny issue #88. See the evidence section below for an example.

This PR also adds a configurable Figure_Title parameter to the Histogram template as an alternative solution for the long title issue. Users can now supply a custom title to override the title generated from the input parameters. Missing or None-like values, such as "None", fall back to the generated title. Note that a custom title replaces the filtering context in the default title, although filtering still produces a logged warning.

The unit tests are updated to cover the new title behavior accordingly. The group filtering behavior is documented in the Histogram and template docstrings in case users choose custom titles.

Related Issue

Testing

  • python -m pytest -q -p no:cacheprovider tests/test_visualization/test_histogram.py tests/templates/test_histogram_template.py — 52 passed.
  • Inspected notebook outputs for grouped and faceted Histograms, including a named Table and a narrow figure. Compared the before and after title layouts.
  • Inspected notebook outputs for grouped and faceted custom titles and the None-like fallback, and checked the resulting titles.
  • git diff --check upstream/dev...HEAD — passed.

Evidence

Before

Histogram before the title break.

histogram_before-wrap

After Wrapping

Histogram after the title break.

histogram_after-wrap

After Customizing

Histogram with a custom title; filtering information is not added automatically.

histogram_after-custom

More comparisons

For additional grouped, filtered, and faceted comparisons, see the comparison page.

@zhan4329 zhan4329 changed the title fix(histogram): separate grouping details in titles fix(histogram): wrap default titles and allow custom titles Nov 9, 2026
@zhan4329
zhan4329 marked this pull request as ready for review November 9, 2026 04:16
@zhan4329 zhan4329 changed the title fix(histogram): wrap default titles and allow custom titles feat(histogram): wrap default titles and allow custom titles Nov 9, 2026
@georgezakinih
georgezakinih requested a balanced review from Copilot November 9, 2026 13:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the histogram title readability and customization changes.

No open issues 🎉

What changed in this PR

This PR improves Histogram title readability for SPAC_Shiny by splitting generated titles across lines and allowing custom titles through the template.

Changes:

  • Move grouping or faceting details and filtering context onto a second title line.
  • Support Figure_Title overrides, with missing or None-like values falling back to generated titles.
  • Expand title tests and clarify group-filtering documentation.
File Description
tests/​templates/​test_histogram_template.py Tests multiline titles, named tables, custom overrides, and None-like fallbacks.
src/​spac/​visualization.py Clarifies the max_groups filtering docstring; no functional changes.
src/​spac/​templates/​histogram_template.py Adds custom titles, wraps generated titles, and documents filtering context.

Review effort: Balanced

@georgezakinih
georgezakinih merged commit 863c38b into FNLCR-DMAP:dev Nov 9, 2026
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.

3 participants