【发布时间】:2019-07-24 09:42:57
【问题描述】:
我有以下代码:
my_palette <- colorRampPalette(rev(RColorBrewer::brewer.pal(11, "RdBu")))(n = 50)
par(mar = c(7, 4, 4, 2) + 0.1)
gplots::heatmap.2(as.matrix(mtcars),
Colv = TRUE,
Rowv = TRUE,
col = my_palette,
density.info = "none",
key = TRUE,
scale = "none",
ylab = "Y_LABEL",
xlab = "X_LABEL",
trace = "none",
margins = c(12, 8))
它产生了这个情节:
请注意,颜色键中最红的颜色对应于 mtcars 的最大值,即 472。
有没有办法将最大值增加到 1000,以便热图中的颜色范围从 0 到 1000?
使用该方案,值为 472 的单元格将少得多红色,甚至是蓝色或白色。
【问题讨论】: