Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guess which automatically for HeatmapAnnotation #1140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Yunuuuu
Copy link

@Yunuuuu Yunuuuu commented Nov 24, 2023

Now, it's no need to set which in HeatmapAnnotation function, we just guess it by argument, top_annotation, bottom_annotation, left_annotation and right_annotation, these can give exact which.

library(ggplot2)
library(ComplexHeatmap)
#> Loading required package: grid
#> ========================================
#> ComplexHeatmap version 2.15.4
#> Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
#> Github page: https://github.com/jokergoo/ComplexHeatmap
#> Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
#> 
#> If you use it in published research, please cite either one:
#> - Gu, Z. Complex Heatmap Visualization. iMeta 2022.
#> - Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
#>     genomic data. Bioinformatics 2016.
#> 
#> 
#> The new InteractiveComplexHeatmap package can directly export static 
#> complex heatmaps into an interactive Shiny app with zero effort. Have a try!
#> 
#> This message can be suppressed by:
#>   suppressPackageStartupMessages(library(ComplexHeatmap))
#> ========================================
x <- sample(1:10, 10L)
m <- matrix(rnorm(100), nrow = 10L)
rownames(m) <- paste0("row ", seq_len(nrow(m)))
colnames(m) <- paste0("col ", seq_len(ncol(m)))
draw(Heatmap(m,
  top_annotation = HeatmapAnnotation(
    foo = anno_points(x, height = unit(5, "cm"))
  )
))

image

draw(Heatmap(m,
  bottom_annotation = HeatmapAnnotation(
    foo = anno_points(x, height = unit(5, "cm"))
  )
))

image

draw(Heatmap(m,
  left_annotation = HeatmapAnnotation(
    foo = anno_points(x, width = unit(5, "cm"))
  )
))

image

draw(Heatmap(m,
  right_annotation = HeatmapAnnotation(
    foo = anno_points(x, width = unit(5, "cm"))
  )
))

image

Created on 2023-11-24 with reprex v2.0.2

@Yunuuuu Yunuuuu changed the title guess which automatically for Heat guess which automatically for HeatmapAnnotation Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant