####################################
library(ggtree)
## Registered S3 method overwritten by 'treeio':
## method from
## root.phylo ape
## ggtree v2.2.4 For help: https://yulab-smu.github.io/treedata-book/
##
## If you use ggtree in published research, please cite the most appropriate paper(s):
##
## [36m-[39m Guangchuang Yu. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics, 2020, 69:e96. doi:10.1002/cpbi.96
## [36m-[39m Guangchuang Yu, Tommy Tsan-Yuk Lam, Huachen Zhu, Yi Guan. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution 2018, 35(12):3041-3043. doi:10.1093/molbev/msy194
## [36m-[39m Guangchuang Yu, David Smith, Huachen Zhu, Yi Guan, Tommy Tsan-Yuk Lam. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. Methods in Ecology and Evolution 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
hc <- hclust(dist(mtcars))
ggtree(hc)

ggtree(hc,layout = "circular")+
geom_tiplab2(offset=10)+
xlim(0,300)

df<-iris[,1:4]
head(df)
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1 5.1 3.5 1.4 0.2
## 2 4.9 3.0 1.4 0.2
## 3 4.7 3.2 1.3 0.2
## 4 4.6 3.1 1.5 0.2
## 5 5.0 3.6 1.4 0.2
## 6 5.4 3.9 1.7 0.4
rownames(df)<-paste(iris$Species,1:150,sep="_")
hc<-hclust(dist(df))
library(ggtree)
help(package="ggtree")
ggtree(hc,layout="circular")+
xlim(0,5)+
geom_tiplab2(offset=0.1,
size=2)+
#geom_text(aes(label=node))+
geom_highlight(node = 152,fill="red")+
geom_highlight(node=154,fill="steelblue")+
geom_highlight(node=155,fill="green")+
geom_cladelabel(node=152,label="virginica",
offset=1.2,barsize = 2,
vjust=-0.5,color="red")+
geom_cladelabel(node=154,label="versicolor",
offset=1.2,barsize = 2,
hjust=1.2,color="steelblue")+
geom_cladelabel(node=155,label="setosa",
offset=1.2,barsize = 2,
hjust=-1,color="green")
## Warning: Ignoring unknown parameters: vjust
