1
我有以下脚本用于在Rstudio中使用Heatmap创建热图。一切看起来不错,着色,树状图大小和位置,字体大小,列注释(标签),但我似乎无法添加行标签。如何在Heatmap中添加行标签(注释)
我的数据文件是制表符分隔的文本文件,用标题行(在热图列名),1列有样品名称(我希望这些显示在热图行标签)
这是我的脚本:
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"))
一切看起来不错,但我的热图上没有行标签(只有列标签)。