1

我正在使用 pheatmap,但我不知道如何为指定热图左侧显示的注释的数据框设置断点。我知道使用中断函数可以确定正在绘制的数据的中断,但是如何对添加到绘图中的注释执行相同的操作?这里我放了代码示例:

library(pheatmap)
library(RColorBrewer)
library(ALL)
library(gplots)

data("ALL")
expressionData = exprs(ALL)

#setting breaks to 0 to 5 then 5.01 to 10
breaks = c(seq(0, 5, length.out = 101),seq(5.01, 10, length.out = 101))
breaks2 <- breaks

#setting colors
my_palette <- colorRampPalette(c("blue", "white", "red"))(n = 201)

#generation of the data from the gene that we want to put on the left side of our pheatmap
data_gene <- as.data.frame(expressionData[1:10,1])
colnames(data_gene) <- "gene"

#setting the annotation row and setting the color of data_gene
annotation_row = data.frame(data_gene)
ann_colors = list(gene= bluered(75))

#pheatmap
pheatmap(expressionData[1:10, ], color = my_palette, breaks = breaks2, annotation_row = annotation_row, annotation_colors = ann_colors)

pheatmap 结果图像

在这里,“基因”的休息时间是自动设置的,从 4 到 9。假设我希望它们从 0 到 5,然后到 5.01 到 10。有人知道该怎么做吗?

4

0 回答 0