79083489

Date: 2024-10-13 15:25:31
Score: 1.5
Natty:
Report link

In the development version of ggalign, I've introduced a new cutree argument, allowing users to apply any custom function for tree cutting. Just replace the iris data with yours. The object is a ggplot-like object, you can color the branch by mapping.

library(ggalign)
#> Loading required package: ggplot2
ggstack(iris[, -5L], "v") +
    align_dendro(
        aes(color = branch),
        cutree = function(tree, dist, k, h) {
            dynamicTreeCut::cutreeDynamic(tree, distM = dist, method = "tree")
        }
    ) +
    scale_y_continuous(expand = expansion()) +
    scale_color_brewer(palette = "Dark2") +
    theme(axis.text.x = element_text(angle = -90, hjust = 0))

Created on 2024-10-13 with reprex v2.1.0 ~
~

enter image description here

Reasons:
  • Probably link only (1):
  • Contains signature (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Yun