R语言 希望行和列标题的一部分在complexheatmap中以斜体显示

bprjcwpo  于 2023-11-14  发布在  其他
关注(0)|答案(1)|浏览(139)

我在R中绘制了一个复杂的热图,其中我将column_title和row_title指定为“k-mat”,但我只想用斜体显示k-mat中的“k”-如何在R中获得它?

library(ComplexHeatmap)
Heatmap(KI2, 
  col=custom_palette,
  show_row_dend=F,
  show_column_dend=F,
  show_row_names=F,
  show_column_names=F,
  heatmap_legend_param = list(title = "CNV"),
  column_title = "k-mat",
  column_title_side = "bottom",
  row_title = "k-mat",,
  row_title_gp = gpar(fontsize = 20),
  row_title_side = "left",
  column_title_gp = gpar(fontsize = 20)
)

字符串
以下是我的数据:

dput(KI2)
structure(c(1, 0.866862, 0.836374, 0.881172, 0.84559, 0.881172, 
0.841952, 0.84559, 0.822808, 0.738473, 0.866862, 1, 0.839971, 
0.985056, 0.848719, 0.985056, 0.907625, 0.848719, 0.87095, 0.805771, 
0.836374, 0.839971, 1, 0.854117, 0.979997, 0.854117, 0.824098, 
0.979997, 0.795768, 0.85479, 0.881172, 0.985056, 0.854117, 1, 
0.862909, 1, 0.922108, 0.862909, 0.88525, 0.819747, 0.84559, 
0.848719, 0.979997, 0.862909, 1, 0.862909, 0.832983, 1, 0.813744, 
0.864407, 0.881172, 0.985056, 0.854117, 1, 0.862909, 1, 0.922108, 
0.862909, 0.88525, 0.819747, 0.841952, 0.907625, 0.824098, 0.922108, 
0.832983, 0.922108, 1, 0.832983, 0.855562, 0.789365, 0.84559, 
0.848719, 0.979997, 0.862909, 1, 0.862909, 0.832983, 1, 0.813744, 
0.864407, 0.822808, 0.87095, 0.795768, 0.88525, 0.813744, 0.88525, 
0.855562, 0.813744, 1, 0.760849, 0.738473, 0.805771, 0.85479, 
0.819747, 0.864407, 0.819747, 0.789365, 0.864407, 0.760849, 1
), .Dim = c(10L, 10L), .Dimnames = list(NULL, c("V1", "V2", "V3", 
"V4", "V5", "V6", "V7", "V8", "V9", "V10")))


有可能吗?

zf9nrax1

zf9nrax11#

可以使用plotmath表达式:

library(ComplexHeatmap)

Heatmap(KI2, 
        show_row_dend = FALSE,
        show_column_dend = FALSE, 
        show_row_names = FALSE,
        show_column_names = FALSE,
        heatmap_legend_param = list(title = "CNV"),
        column_title = expression(italic(k)-mat),
        column_title_side = "bottom",
        row_title = expression(italic(k)-mat),
        row_title_gp = gpar(fontsize = 20),
        row_title_side = "left",
        column_title_gp = gpar(fontsize = 20))

字符串


的数据

相关问题