Repository navigation
plot(tree, what = "heatmap"): draw a giottoTree's own correlation matrix - #156
Merged
Merged
Conversation
This was referenced Oct 1, 2026
Closed
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.
A
plot()method for thegiottoTreereturned byGiotto::calculateClusterTree():what = "tree"(the default): the plainhclustplot, as before....passes through, soplot(tree, hang = -1)keeps working.what = "heatmap": drawsattr(tree, "cor_matrix")in leaf order, with the tree's branches on both axes (ComplexHeatmap, already in Suggests). The title names the correlation type and the feature count.This is the one place where drawing the attached matrix is honest: it's the matrix the branches were built from, so colors and branches can't disagree. It describes the tree, not whatever object is current. For correlations recomputed from an object in a tree's order, use
showClusterHeatmap(cluster_custom_order = tree$labels[tree$order])(#154), which deliberately draws no branches. A tree without its matrix errors and points there.Why it lives here
Drawing belongs in GiottoVisuals, next to
plotClusterTree()andshowClusterHeatmap(). An S3 class is just a string, so the method is registered here (S3method(plot, giottoTree)) with no dependency on Giotto. Giotto imports GiottoVisuals, so loading Giotto, where trees are made, registers it. The contract is the attributes Giotto documents oncalculateClusterTree()(params,cor_matrix), andplotClusterTree()already readsparamsthe same way.This replaces giotto-suite/Giotto#1324, which put the same method in Giotto.
Verification
In
test-plot-cluster-tree.R:plot(tree, hang = -1)returns the tree with no warningcor_matrixin leaf order, and its row dendrogram is the treeshowClusterHeatmap(cluster_custom_order =)In a plain user session loading Giotto,
getS3method("plot", "giottoTree")resolves to GiottoVisuals, and bothwhatoptions dispatch. All 47 tests pass (106 expectations).🤖 Generated with Claude Code