Skip to content

Provide a general solution for faceted tree structure #634

Open
@Yunuuuu

Description

@Yunuuuu

The ggtree package is an excellent tool for drawing phylogenetic trees. However, a common limitation among many ggplot2 extensions for tree structures is that they typically confine a single tree to a single panel. To overcome this constraint, a practical workaround is to draw the tree lines across multiple panels twice.

In my heatmap package, ggalign, I have adopted this strategy to render dendrograms. This package is a pure ggplot2 extension and does not rely on other heatmap packages like ComplexHeatmap. The relevant script can be found in the file located at https://github.com/Yunuuuu/ggalign/blob/main/R/dendrogram.R.

By employing this solution, ggalign facilitates the creation of sophisticated heatmaps, as illustrated in the following examples:

three panels in columns

three panels in columns and two panels in rows

Y叔,我是从硕士时期(快5年了)起跟随您学习 R 语言,一直关注您的知识星球,直到关停。当时我对 R 语言的掌握还很初级,连在 ggplot 图上添加一个简单的条带都感到困难,正是的知识星球上得到了您的指点。非常感谢您当初的教导和帮助。

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