Fix plot_multicomparison_fc with default figsize#966
Closed
kimjune01 wants to merge 3 commits into
Closed
Conversation
Fixes scverse#755 The function failed when seaborn's heatmap didn't display tick labels (which happens with certain figsize values). This occurred because the code assumed tick labels would always be present when plotting significance markers. The fix ensures xticklabels=True and yticklabels=True are set by default, while still allowing users to override via heatmap_kwargs. Changes: - Set default xticklabels=True and yticklabels=True in heatmap call - Add regression test for default figsize behavior
…red labels Previous approach extracted tick labels from the rendered plot, which failed when seaborn hid labels (small figsize, many genes, or explicit xticklabels=False). New approach calculates positions directly from DataFrame structure: - Seaborn places cell centers at 0.5, 1.5, 2.5, etc. - Works regardless of label visibility - Faster (no DOM extraction) - Immune to matplotlib rendering changes Test updated to actually reproduce the bug (50 genes + small figsize).
Gemini review noted that position calculation assumes non-clustered heatmap. If future maintainer changes to clustermap, marker positions would be wrong. Added comment to make this assumption explicit.
Member
|
Could you please fix the merge conflicts? Thank you |
Contributor
Author
|
Closed during rebase (branch delete + recreate). Replaced by #970. |
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.
Fixes #755.
Seaborn heatmap suppresses tick labels when the figure is too narrow, causing plot_multicomparison_fc to crash with ValueError when trying to position significance markers (the code looks up gene names in x_labels, but those labels are missing).
This sets xticklabels=True and yticklabels=True as defaults so tick labels are always visible. Users can still override via heatmap_kwargs if needed.
Also adds a comment noting that the marker positioning assumes a non-clustered heatmap (if a future maintainer switches to clustermap, marker positions would be wrong).