重新创建热图

时间:2018-11-08 16:44:58

标签: r heatmap

我在test.csv中设置了以下数据(6500行)...

Field 1 Field 2 Field 3 Field 4 Field 5 Field 6 Field 7 Field 8 Field 9 Field 10 Field 11 Field 12 Field 13 Field 14 Field 15 Field 16 Field 17 Field 18
1   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
2   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
3   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
4   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
5   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
6   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
7   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
8   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1
9   1     1   1   0   0   1   0    1       1       1       0        1         0         0   1   0   0     1

我需要重新创建此热图的布局和格式。

enter image description here

图例和y轴标签(行/观察值)看起来像是在R之外添加的,但到目前为止,这是我所做的...

library(RColorBrewer)
# Read in dataset
df <- read.csv("test2.csv")

# Set as integer matrix
m <- as.matrix(df[, -1])

# Create colors
blackgrey <- c("black", "grey")
pal <- colorRampPalette(blackgrey)(100)

# Create heatmap
heatmap(m, Rowv = NA, Colv = NA, scale="column", col = pal)

哪个屈服了...

enter image description here

如何更改y轴单位的边界(而不是从1开始计数,每隔2000跳一次)。另外,是否可以像我要复制的热图一样将其移到左侧?

0 个答案:

没有答案