我有一个数据集,我在其中手动为行名分配了一些 unicode(vars
下面我的数据示例中的列):
我将此数据读入 R,将其转换为矩阵,vars
列设置为矩阵的行名,然后使用complexheatmap
包绘制热图 - 但是,它不接受我添加到行名的 unicodes,相反,我得到了这个:
Heatmap(data, name = "log p-value", column_title = "Sets",
row_title = "Vars",
column_names_rot = 45,
cluster_rows = TRUE, cluster_columns = FALSE, col = col_fun)
Warning messages:
1: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : conversion failure on 'var1�' in 'mbcsToSbcs': dot substituted for <e0>
2: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : conversion failure on 'var2�' in 'mbcsToSbcs': dot substituted for <e0>
3: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : conversion failure on 'var3�' in 'mbcsToSbcs': dot substituted for <e0>
4: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : conversion failure on 'var4�' in 'mbcsToSbcs': dot substituted for <a0>
然后,对于带有 unicode 的行名,输出图为空白。我怎样才能让这个热图接受行名中的 unicode?到目前为止,我只发现了类似的问题,这些问题集中在 ggplot 上,而不是使用其他包,如 complexheatmap。任何帮助或指导表示赞赏。
编辑:尝试添加示例代码,但是当我直接从 R 中获取它时,它不允许我包含 unicode,因为它们实际上在上图中看起来(例如 †、‡):
data <- structure(c(27.88329977, 18.12896031, 17.83458703, 25.67060325,
23.32033202, 24.50406143, 16.98524839, 20.43345407, 19.18854732,
15.17015206, 20.68765274, 17.97664243, 17.5016736, 17.66349143,
17.57835389, 17.33819738, 14.99944861, 15.04948794, 10.6137363,
9.360755894, 20.16400165, 13.88834838, 11.18364291, 8.568037579,
6.621062251), .Dim = c(5L, 5L), .Dimnames = list(c("var1\xe0",
"var2\xe0", "var3\xe0", "var4\xa0", "va5\xa0"
), c("col1", "col2", "col3",
"col4", "col5")))