【发布时间】:2017-09-19 22:02:00
【问题描述】:
我有以下脚本用于在 Rstudio 中使用 Heatmap 创建热图。一切看起来都不错,颜色、树状图大小和位置、字体大小、列注释(标签),但我似乎无法添加行标签。
我的数据文件是制表符分隔的文本文件,有一个标题行(热图中的列名),第一列有示例名称(我希望这些在热图中显示为行标签)
这是我的脚本:
source("https://bioconductor.org/biocLite.R")
biocLite("ComplexHeatmap")
library(ComplexHeatmap)
filename <- "Data.txt"
my_data <- read.table(filename, sep ="\t", quote = "", stringsAsFactors =`FALSE,header = TRUE)`
# Make the heatmap data into a matrix
# [all rows, columns 2-13]
# Leave out 1st column (sample names) since they don't not belong in the heatmap
my_matrix <- as.matrix(my_data[ ,c(2:13)])
# Cluster by rows only, not columns
# Increase dendogram width
# Change font size to 0.8
Heatmap(my_matrix, cluster_columns = FALSE,
column_names_gp = gpar(cex=0.8),
row_hclust_width = unit(3, "cm"))
一切看起来都很棒,但我的热图上没有行标签(只有列标签)。
【问题讨论】: