ComplexHeatmap row_title_side无法正常工作

时间:2019-10-18 13:28:53

标签: r

我正在尝试使用ComplexHeatmap包创建一个简单的热图,但是row_title_side似乎不起作用,或者我丢失了某些东西吗?

可重现的示例是:

set.seed(1)
mat = matrix(rnorm(64), 8)
colnames(mat) = letters[1:8]
labels <- colnames(mat)

mat2 = cor(mat)
od = hclust(dist(mat2))$order
mat2 = mat2[od, od]
Heatmap(
  mat2,
  col = colorRamp2(c(-1, 0, 1), c("red", "white", "green")),
  cluster_rows = FALSE,
  cluster_columns = FALSE,
  heatmap_legend_param = list(title = "Cor"),
  rect_gp = gpar(type = "none"),

  row_title_side = 'left',

  cell_fun = function(j, i, x, y, w, h, col) {
    if (i > j) {
      grid.rect(x, y, w, h, gp = gpar(fill = col))
      grid.text(sprintf("%.2f", mat2[i, j]), x, y)
    }
  }
)

使用上面的代码,我得到的是:heatmap_image

0 个答案:

没有答案