1
2

# 默认绘图
pheatmap(test)

# scale = "row"参数对行进行归一化
pheatmap(test, scale = "row")

# clustering_method参数设定不同聚类方法,默认为"complete",可以设定为'ward', 'ward.D', 'ward.D2', 'single', 'complete', 'average', 'mcquitty', 'median' or 'centroid'
pheatmap(test,scale = "row", clustering_method = "average")
# clustering_distance_rows = "correlation"参数设定行聚类距离方法为Pearson corralation,默认为欧氏距离"euclidean"
pheatmap(test, scale = "row", clustering_distance_rows = "correlation")
# color参数自定义颜色
pheatmap(test, color = colorRampPalette(c("navy", "white", "firebrick3"))(50))

# cluster_row = FALSE参数设定不对行进行聚类
pheatmap(test, cluster_row = FALSE)
# legend_breaks参数设定图例显示范围,legend_labels参数添加图例标签
pheatmap(test, legend_breaks = c(1:5), legend_labels = c("1.0","2.0","3.0","4.0","5.0"))

# legend = FALSE参数去掉图例
pheatmap(test, legend = FALSE)
# border_color参数设定每个热图格子的边框色
pheatmap(test, border_color = "red")

# border=FALSE参数去掉边框线
pheatmap(test, border=FALSE)

# show_rownames和show_colnames参数设定是否显示行名和列名
pheatmap(test,show_rownames=F,show_colnames=F)

# treeheight_row和treeheight_col参数设定行和列聚类树的高度,默认为50
pheatmap(test, treeheight_row = 30, treeheight_col = 50)

# display_numbers = TRUE参数设定在每个热图格子中显示相应的数值,number_color参数设置数值字体的颜色
pheatmap(test, display_numbers = TRUE,number_color = "blue")
# number_format = "%.1e"参数设定数值的显示格式
pheatmap(test, display_numbers = TRUE, number_format = "%.1e")

# 自定义数值的显示方式
pheatmap(test, display_numbers = matrix(ifelse(test > 5, "*", ""), nrow(test)))

# cellwidth和cellheight参数设定每个热图格子的宽度和高度,main参数添加主标题
pheatmap(test, cellwidth = 15, cellheight = 12, main = "Example heatmap")

# 构建列注释信息
annotation_col = data.frame(CellType = factor(rep(c("CT1", "CT2"), 5)), Time = 1:5
)
rownames(annotation_col) = paste("Test", 1:10, sep = "")
head(annotation_col)
##       CellType Time
## Test1      CT1    1
## Test2      CT2    2
## Test3      CT1    3
## Test4      CT2    4
## Test5      CT1    5
## Test6      CT2    1
# 构建行注释信息
annotation_row = data.frame(GeneClass = factor(rep(c("Path1", "Path2", "Path3"), c(10, 4, 6)))
)
rownames(annotation_row) = paste("Gene", 1:20, sep = "")
head(annotation_row)
##       GeneClass
## Gene1     Path1
## Gene2     Path1
## Gene3     Path1
## Gene4     Path1
## Gene5     Path1
## Gene6     Path1
# annotation_col参数添加列注释信息
pheatmap(test, annotation_col = annotation_col)
# annotation_col和annotation_row参数同时添加行和列的注释信息
pheatmap(test, annotation_row = annotation_row, annotation_col = annotation_col)
# 自定注释信息的颜色列表
ann_colors = list(Time = c("white", "firebrick"),CellType = c(CT1 = "#1B9E77", CT2 = "#D95F02"),GeneClass = c(Path1 = "#7570B3", Path2 = "#E7298A", Path3 = "#66A61E")
)
head(ann_colors)
# annotation_colors设定注释信息的颜色
pheatmap(test, annotation_col = annotation_col, annotation_colors = ann_colors, main = "Title")
pheatmap(test, annotation_col = annotation_col, annotation_row = annotation_row, annotation_colors = ann_colors)

# annotation_legend = FALSE参数去掉注释图例
pheatmap(test, annotation_col = annotation_col, annotation_legend = FALSE)
# gaps_row = c(10, 14)参数在第10和14行处添加gap, 要求对行不进行聚类
pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, gaps_row = c(10, 14))

# cutree_col = 2参数将列按聚类树的结果分成两部分, 要求对列进行聚类
pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, gaps_row = c(10, 14),cutree_col = 2)

# 对行和列都不聚类,自定义划分行和列的gap
pheatmap(test, annotation_col = annotation_col, cluster_rows = FALSE, cluster_cols = FALSE, gaps_row = c(6, 10, 14), gaps_col = c(2, 5, 8))

# 自定义行的标签名
labels_row = c("", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Il10", "Il15", "Il1b")
# labels_row参数添加行标签
pheatmap(test, annotation_col = annotation_col, labels_row = labels_row)

# 自定义聚类的距离方法
drows = dist(test, method = "minkowski")
dcols = dist(t(test), method = "minkowski")
# clustering_distance_rows和clustering_distance_cols参数设定行和列的聚类距离方法
pheatmap(test, clustering_distance_rows = drows, clustering_distance_cols = dcols)
aa=pheatmap(test,scale="row")  #热图,归一化,并聚类
summary(aa)
order_row = aa$tree_row$order  #记录热图的行排序
order_col = aa$tree_col$order    #记录热图的列排序
datat = data.frame(test[order_row,order_col])   # 按照热图的顺序,重新排原始数据
datat = data.frame(rownames(datat),datat,check.names =F)  # 将行名加到表格数据中
colnames(datat)[1] = "geneid"
write.table(datat,file="reorder.txt",row.names=FALSE,quote = FALSE,sep='\t')  #输出结果,按照热图中的顺序
sessionInfo()

pheatmap 参数整理相关推荐

  1. php中年月日用什么参数,PHP中date()日期函数参数整理

    PHP中date()日期函数参数整理 发布于 2014-11-19 13:34:06 | 105 次阅读 | 评论: 0 | 来源: 网友投递 PHP开源脚本语言PHP(外文名: Hypertext ...

  2. GROMACS运行参数整理(二)

    Gromacs运行参数中文注释 中文注释仅供参考!!! GROMACS运行参数整理(一)点击打开链接 9.Temperature couplingtcoupl = ; 指定耦合方法no ;不使用ber ...

  3. python read_excel 参数_详解pandas库pd.read_excel操作读取excel文件参数整理与实例

    详解pandas库pd.read_excel操作读取excel文件参数整理与实例 来源:中文源码网    浏览: 次    日期:2019年11月5日 详解pandas库pd.read_excel操作 ...

  4. php中date里面的参数,PHP中date()日期函数有关参数整理

    PHP中date()日期函数有关参数整理 更新时间:2011年07月19日 22:47:41   作者: PHP中date()日期函数有关参数整理,需要的朋友可以参考下. 在页面的最前页加上 date ...

  5. linux常用终端命令参数整理

    命令常用参数整理 文章目录 1.xargs 2.tar 3.awk 4.grep 5.sed 6.wget 7.curl 8.find 9.watch 10.scp 11.diff 12.screen ...

  6. python read_excel header_详解pandas库pd.read_excel操作读取excel文件参数整理与实例

    除了使用xlrd库或者xlwt库进行对excel表格的操作读与写,而且pandas库同样支持excel的操作:且pandas操作更加简介方便. 首先是pd.read_excel的参数:函数为: pd. ...

  7. SharePoint【学习笔记】-- SharePoint 2010 技术参数整理

    今天整理一些 SharePoint 2010 的技术参数,其内容都来自 SharePoint-Sandbox 网站. 有些参数值是硬性的,比如列表单条记录的尺寸:而有些是为了使用和性能考虑的推荐值. ...

  8. Hadoop常用参数整理(HDFS/Yarn/MapReduce/GC)

    背景 最近整理了一些常用的Hadoop集群相关配置参数,并对相关参数进行调优,其中有一些参数能影响到集群的性能等问题,需谨慎使用.本来想在这里把Hbase参数也带上的,由于Hbase参数调优细节太多, ...

  9. pheatmap 参数详解

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言 一.参数解析 二.参考例子 1.基础热图 前言 A function to draw clustered heatma ...

最新文章

  1. 自动驾驶领域:一种实时高精度的城市道路场景语义分割方法
  2. a卡显存检测软件_科普小课堂,A卡玩家如何轻松超频?
  3. SAP Cloud Application Programming bookshop 例子的 Fiori Preview
  4. git: command not found
  5. matlab中怎么表示概率,[转载]matlab中的概率函数
  6. Mysql数据库Sql语句执行效率-Explain
  7. 关于灵魂安放,年轻人如何选择适合自己的城市呢?学长有话说
  8. java动态数组储存敌机_如何使用参数通过graphql将动态数组字符串存储为neo4j中的节点属性?...
  9. spring(二)-反射、动态代理
  10. CentOS6.5 webserver---网络配置
  11. 传微软PK谷歌 将于2014年推出智能眼镜
  12. 2.1 InnoDB存储引擎(概述、版本、体系结构)
  13. AD15使用出现的小问题
  14. edz文件怎么导入EPLAN Electric P8
  15. C语言控制鼠标自动画图
  16. 徐亦达老师机器学习课程
  17. 如何检查java代码有误_Java代码查错题
  18. tc ebpf sample - tethering offload on linux pc
  19. java 队列线程池_Java线程池Executor使用
  20. 双向链表:P1996约瑟夫问题的解决方法

热门文章

  1. 记一些css 3效果
  2. error;It could not find or load the Qt platform plugin “windows”
  3. redis 突然大量逐出导致读写请求block
  4. iOS核心动画高级技术(十四) 图像IO
  5. oracle 更新丢失
  6. C#编程(四十五)----------格式字符串
  7. Veritas推出全多云环境新技术
  8. .net core快速上手
  9. ubuntu 中安装memcache,并给出一个简单的实例·
  10. mysql备份slave_MySQL主(Master)从(Slave)备份;