fix: render heatmap metadata colour bars - #21
Merged
Conversation
eilidhmacnicol
force-pushed
the
fix/heatmap-colour-bars
branch
from
June 4, 2026 13:19
71eae5c to
1be0a60
Compare
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.
Goal 5 — complete a half-wired feature (pre-1.0 bug fix)
plot_lv_heatmapandplot_bootstrap_heatmappassrow_colors/col_colors(the--x-meta/--y-metacategory colours) intoplot_heatmap, butplot_heatmapbuilds the figure withsns.heatmap, which has no row/column colour-bar support — so the colours were silently dropped and the metadata colour-coding never appeared on--all-plotsheatmaps. This completes the wiring rather than removing it.Approach
When colour bars are requested, render them via
sns.clustermap(row_cluster=False, col_cluster=False, row_colors=..., col_colors=...)— a non-clustered heatmap that does support colour strips, with the empty dendrogram axes hidden. The divergingvlagscale, symmetric[-v, v]range, and annotation-suppression behaviour are preserved.Heatmaps without metadata are unchanged — they keep the original
sns.heatmappath (used by the cross-correlation heatmap and metadata-free bootstrap heatmaps). Only the previously-broken colour-bar path changes.Changes
plotting.plot_heatmap: branch to a new_heatmap_with_colour_barshelper whenrow_colors/col_colorsare present.docs/usage.md; CHANGELOG fix entry.Tests (written first, watched fail)
test_plotting: LV heatmap renders both row and column colour bars; bootstrap heatmap renders a row colour bar only (columns are LVs, no metadata); the no-colour path does not invokeclustermap(behaviour-unchanged guard). Assertions check the colour-bar axes actually drew artists, not just that a file was written.All tests pass; ruff clean; coverage 97.8% (floor 95%). Verified the output visually — the row/column category bars render with the correct colours.
🤖 Generated with Claude Code