如何解决在ComplexHeatmap中更改图例的顺序
交叉发布: issues/557
我找不到在ComplexHeatmap中更改图例顺序的解决方案。
示例
library(ComplexHeatmap)
set.seed(100)
ha <- HeatmapAnnotation(foo = rep(c("gr1","gr2"),each = 5),annotation_label = c("col_an"))
ra <- HeatmapAnnotation(pt = rep(letters[1:2],which = "row",annotation_label = c("row_an"))
Heatmap(matrix(rnorm(100),10),name = "mat",top_annotation = ha,left_annotation = ra)
问题:如何按照从上到下的顺序排列图例?
-
col_an
-
row_an
-
mat
SessionInfo
xfun::session_info()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6,RStudio 1.3.1056
Locale: en_US.UTF-8 / en_US.UTF-8 / en_US.UTF-8 / C / en_US.UTF-8 / en_US.UTF-8
Package version:
assertthat_0.2.1 backports_1.1.8 base64enc_0.1.3 BiocGenerics_0.34.0 circlize_0.4.10
cli_2.0.2 clue_0.3-57 cluster_2.1.0 colorspace_1.4-1 compiler_4.0.2
ComplexHeatmap_2.5.4 crayon_1.3.4 curl_4.3 digest_0.6.25 ellipsis_0.3.1
evaluate_0.14 fansi_0.4.1 GetoptLong_1.0.2 GlobalOptions_0.1.2 glue_1.4.1
graphics_4.0.2 grDevices_4.0.2 grid_4.0.2 highr_0.8 htmltools_0.5.0
IRanges_2.22.2 jsonlite_1.7.0 knitr_1.29 lifecycle_0.2.0 magick_2.4.0
magrittr_1.5 markdown_1.1 methods_4.0.2 mime_0.9 parallel_4.0.2
pillar_1.4.6 pkgconfig_2.0.3 png_0.1-7 purrr_0.3.4 R.cache_0.14.0
R.methodsS3_1.8.0 R.oo_1.23.0 R.utils_2.9.2 RColorBrewer_1.1-2 Rcpp_1.0.5
rematch2_2.1.2 rjson_0.2.20 rlang_0.4.7 rmarkdown_2.3 rprojroot_1.3.2
rstudioapi_0.11 S4Vectors_0.26.1 shape_1.4.4 stats_4.0.2 stats4_4.0.2
stringi_1.4.6 stringr_1.4.0 styler_1.3.2 tibble_3.0.3 tinytex_0.25
tools_4.0.2 utf8_1.1.4 utils_4.0.2 vctrs_0.3.2 withr_2.2.0
xfun_0.16
解决方法
这是作者提供的解决方案:
set.seed(100)
ha <- HeatmapAnnotation(foo = rep(c("gr1","gr2"),each = 5),annotation_label = c("col_an"),annotation_name_side = "left")
ra <- HeatmapAnnotation(pt = rep(letters[1:2],which = "row",annotation_label = c("row_an"))
ht = ha %v% Heatmap(matrix(rnorm(100),10),name = "mat",left_annotation = ra)
draw(ht,merge_legend = TRUE,column_dend_side = "top")
https://github.com/jokergoo/ComplexHeatmap/issues/557#issuecomment-673404750
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。