Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a general solution for faceted tree structure #634

Open
Yunuuuu opened this issue Oct 11, 2024 · 0 comments
Open

Provide a general solution for faceted tree structure #634

Yunuuuu opened this issue Oct 11, 2024 · 0 comments

Comments

@Yunuuuu
Copy link

Yunuuuu commented Oct 11, 2024

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 图上添加一个简单的条带都感到困难,正是的知识星球上得到了您的指点。非常感谢您当初的教导和帮助。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant