Skip to content

Bug: Histogram title and legend clipping and readability in Features tab #88

Open

Description

@zhan4329

Problem

In the Features tab, grouped Histograms can have long titles and legends with many long annotation labels. Unfortunately, the current preview can cut off the title and legend, and even when all the text is visible, the plot and labels can be hard to read. The preview also doesn't use the full available width.

For example, select a Feature (e.g., CD25) and a named Table (e.g., arcsinh_percentile), enable "Group By" and "Plot Together", and choose an Annotation with many long values (e.g., manual_phenotype). In the rendered plot, the title and legend are cut off in the preview. A tentative fix is to use tight PNG export (PR forthcoming), but further improvements are needed for readability. See evidence below for a demo.

Proposed fixes

Here are my proposals to fix the issue and improve readability:

  • Use Matplotlib's bbox_inches="tight" when exporting the PNG to include titles and legends outside the figure canvas in the Features preview. (Shiny PR in preparation.)
  • Put grouping or faceting details on a second title line in the Histogram template and adopt the change in Shiny. (Merged in SCSAWorkflow PR #434; Shiny adoption pending.)
  • Expose a custom title control in the Features UI. (Package support merged in SCSAWorkflow PR #434; Shiny control pending.)
  • Abbreviate long labels and provide a way to recover full labels, such as hovering over the plot or using an accompanying label dictionary.
  • Expose the Histogram template's existing Max_Groups filter in the Features UI so users can limit the display to the most frequent groups.
  • Make the preview use the available width while preserving the image's aspect ratio.

Related work

Since this issue was opened (2026-11-08)

  • SCSAWorkflow PR #434 (merged on 2026-11-09) added title wrapping and custom-title support in the Histogram template. The changes have not yet been adopted in SPAC_Shiny.

Previous work

  • SPAC_Shiny PR #66 added an option to shorten axis labels in the Feature vs Annotation heatmap. It may be a useful reference for the Histogram.
  • SCSAWorkflow PR #428 added Max_Groups to the Histogram template. PR #433 used this to display only the most frequent groups when there are too many.
  • SPAC_Shiny PR #86 introduced the PNG preview, which may cause text to be clipped and leave some width unused.

Evidence

Before

An example of Features Histogram in SPAC Shiny Interface with title and legend clipped, running on current dev branch.

Image

After

Features Histogram after setting bbox_inches="tight" in fig_to_png_bytes (PR forthcoming).

Image

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions