plot单独画出pheatmap返回的聚类结果(聚类树)

前面两篇文章介绍到pheatmap返回行和列的hclust结果: pheatmap返回的结果解释(获得新的排序信息)  http://www.omicsclass.com/article/507 cutree对pheatmap返回结果实现聚类cluster划分 ...

前面两篇文章介绍到pheatmap返回行和列的hclust结果:

pheatmap返回的结果解释(获得新的排序信息)  https://www.omicsclass.com/article/507

cutree对pheatmap返回结果实现聚类cluster划分  https://www.omicsclass.com/article/508

1、按照前两篇文章的基础数据获得的热图结果,对行(基因的聚类结果)聚类树单独进行绘制,可以借助plot()函数:

默认画法

> plot(list$tree_row)

attachments-2018-10-FVdgIlI65bc9890d737e0.jpg而有一个有趣的函数rect.hclust()可以将hclust结果绘图,并圈选出不同的cluster,譬如设定3个cluser:

> rect.hclust(list$tree_row,k=3)

得到如下结果:

attachments-2018-10-2frJ6o575bc989c6a5fb5.jpg

2、而将hclust结果转换成另类树形图as.dendrogram()可以选择type画出其他形状的树形图:

这个树形图一共包含两个type,可以查询?as.dendrogram() 或者?plot.dendrogram得知

> plot(as.dendrogram(list$tree_row),type = "triangle")

attachments-2018-10-eNvmbX8G5bc98b0cba969.jpg或者:

> plot(as.dendrogram(list$tree_row),type = "rectangle")

attachments-2018-10-ovLbMh9e5bc98b47a002c.jpg3、R包ape 中as.phylo(list$tree_row) 可以将hclust返回的结果转化成系统进化树,从而画出新的树形图:

这种树形图画法type很多,可以查询?plot.phylo 获得

默认:

> plot(as.phylo(list$tree_row),type="phylogram")

attachments-2018-10-KcMcdOcE5bc98ed0db9ac.jpg

install.packages("ape")
library(ape)
> plot(as.phylo(list$tree_row),type="fan")


attachments-2018-10-3MuUWEGv5bc98d97eb8e0.jpg


type

a character string specifying the type of phylogeny to be drawn; it must be one of "phylogram" (the default), "cladogram", "fan", "unrooted", "radial" or any unambiguous abbreviation of these.


cladogram

attachments-2018-10-nYTw54qp5bc98f6754122.jpg

unrooted

attachments-2018-10-aKtHmyYP5bc98f4679ab8.jpgradial
attachments-2018-10-G5HRz0Io5bc98f8792faa.jpg


……


如果想提升自己的绘图技能,我们推荐:R语言绘图基础(ggplot2)

更多生物信息课程:https://study.omicsclass.com/index


  • 发表于 2018-10-19 15:44
  • 阅读 ( 6948 )
  • 分类:R

0 条评论

请先 登录 后评论
Daitoue
Daitoue

167 篇文章

作家榜 »

  1. omicsgene 658 文章
  2. 安生水 328 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. 红橙子 78 文章
  6. CORNERSTONE 72 文章
  7. xun 68 文章
  8. rzx 67 文章