Title: | Drawing 'dendrogram' using 'ggtree' |
---|---|
Description: | Offers a set of 'autoplot' methods to visualize tree-like structures (e.g., hierarchical clustering and classification/regression trees) using 'ggtree'. You can adjust graphical parameters using grammar of graphic syntax and integrate external data to the tree. |
Authors: | Guangchuang Yu [aut, cre, cph] , Shuangbin Xu [ctb] , Chuanjie Zhang [ctb] |
Maintainer: | Guangchuang Yu <[email protected]> |
License: | Artistic-2.0 |
Version: | 1.9.0 |
Built: | 2024-10-30 08:05:23 UTC |
Source: | https://github.com/bioc/ggtreeDendro |
autoplot
autoplot(object, ...) ## S3 method for class 'hclust' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'linkage' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'dendrogram' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'agnes' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'diana' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'twins' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'bclust' autoplot(object, ...) ## S3 method for class 'hdbscan' autoplot(object, ...) ## S3 method for class 'hkmeans' autoplot(object, ...) ## S3 method for class 'dendro' autoplot(object, ...) ## S3 method for class 'pvclust' autoplot( object, layout = "dendrogram", ladderize = FALSE, label_edge = FALSE, pvrect = FALSE, alpha = 0.95, hang = 0.1, ... ) ## S3 method for class 'ClusterExperiment' autoplot(object, layout = "rectangular", ...) ## S3 method for class 'genoMatriXeR' autoplot(object, hctype = "rows", ...) ## S3 method for class 'multiLocalZScore' autoplot(object, ...)
autoplot(object, ...) ## S3 method for class 'hclust' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'linkage' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'dendrogram' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'agnes' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'diana' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'twins' autoplot(object, layout = "dendrogram", ladderize = FALSE, hang = 0.1, ...) ## S3 method for class 'bclust' autoplot(object, ...) ## S3 method for class 'hdbscan' autoplot(object, ...) ## S3 method for class 'hkmeans' autoplot(object, ...) ## S3 method for class 'dendro' autoplot(object, ...) ## S3 method for class 'pvclust' autoplot( object, layout = "dendrogram", ladderize = FALSE, label_edge = FALSE, pvrect = FALSE, alpha = 0.95, hang = 0.1, ... ) ## S3 method for class 'ClusterExperiment' autoplot(object, layout = "rectangular", ...) ## S3 method for class 'genoMatriXeR' autoplot(object, hctype = "rows", ...) ## S3 method for class 'multiLocalZScore' autoplot(object, ...)
object |
input object |
... |
additional paramters that passed to ggtree |
layout |
layout for plotting the tree |
ladderize |
logical whether ladderize the tree (default FALSE) |
hang |
numeric The fraction of the tree plot height by which labels should hang below the rest of the plot. A negative value will cause the labels to hang down from 0. |
label_edge |
logical whether display the label of edge (only for pvclust object), default is FALSE. |
pvrect |
logical whether display the clusters with relatively high/low p-values, default is FALSE. (only for pvclust object) |
alpha |
numeric the threshold value for p-values, default is 0.95 (only for pvclust object). |
ggtree object
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + geom_tiplab()
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + geom_tiplab()
geom_line_cutree
geom_line_cutree(group, linetype = "dashed", offset = 0, ...)
geom_line_cutree(group, linetype = "dashed", offset = 0, ...)
group |
output of cutree or number of subtree |
linetype |
linetype |
offset |
offset of the line |
... |
additional parameters to set the line (e.g., color, size, etc.) |
line layer
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + geom_line_cutree(4)
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + geom_line_cutree(4)
geom_rect_subtree
geom_rect_subtree(group = NULL, color = "red", ...)
geom_rect_subtree(group = NULL, color = "red", ...)
group |
output of cutree or number of subtree |
color |
border color to highlight subtrees |
... |
additional parameters pass to 'ggtree::hilight()' |
rect layer
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + geom_rect_subtree(4)
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + geom_rect_subtree(4)
scale tree color by subtree (e.g., output of cutree, kmeans, or other clustering algorithm)
scale_color_subtree(group) scale_colour_subtree(group)
scale_color_subtree(group) scale_colour_subtree(group)
group |
taxa group information |
updated tree view
Guangchuang Yu
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + scale_color_subtree(3)
d <- dist(USArrests) hc <- hclust(d, "ave") autoplot(hc) + scale_color_subtree(3)