ComplexHeatmap: Not able to change the annotations size of the heatmap
0
0
Entering edit mode
Ashish Jain ▴ 10
@ashish-jain-14944
Last seen 3.0 years ago
Iowa State University

I am not able to increase the size (height) of the column annotations of the heatmap. I tried annotation_height, height, and re_size but none of them seems to work.

df<-featuresFilt[,c("Tissue","New.Diagnosis","Age","Sex","Race","TumorSite")]
colnames(df)<-c("Tissue","Diagnosis","Age","Sex","Race","TumorSite")
ha = HeatmapAnnotation(
  #df = features[,c(5,6,7,13,15)],
  #df = featuresFilt[,c(3,4,5,6,13,7)],
  df = df,
  col = list(Tissue = col_tissue,
             Diagnosis = col_disease,#c("Normal" = "black","Adrenocortical carcinoma" = "red"),#col_cluster,#c("Adrenocortical carcinoma" = "red", "Normal" = "black", "Carcinoid tumor" = "blue","Gastrointestinal stromal tumor"="brown"),
             Age = col_age,
             Sex = genderColor,#c("Male"="turquoise","Female"="brown"),
             #RIN = col_rin,
             Race =raceColor,#c("White"="#B35806","Unknown"="#FDBC6B","Other"="black","Black or African American"="#E3E4EF","Native Hawaiian or Other Pacific Islander"="#8D81B6","Asian"="blue"),
             TumorSite=tumorSiteColor#c("Metastasis"="turquoise","Primary Site"="brown","Recurrence"="black")
             #cluster = col_cluster
  ),
  #annotation_height = unit(rep(6,6), "mm"),
  #height = unit(36,"mm"),
  #annotation_name_gp =  gpar(fontsize = 14,fontface = 2),
  #annotation_legend_param = list(title_gp = gpar(fontsize = 15, fontface = 2),labels_gp = gpar(fontsize = 12)),
  #annotation_height = unit(rep(2,6), "cm"),
  annotation_height = c(TumorSite = unit(8, "mm"),Diagnosis=unit(8, "mm"),Age=unit(8, "mm"),Sex=unit(8, "mm"),Race=unit(8, "mm"),TumorSite=unit(8, "mm")), height = unit(48, "mm")
)

print(ha)

A HeatmapAnnotation object with 6 annotations
  name: heatmap_annotation_273 
  position: column 
  items: 47 
  width: 1npc 
  height: 31.757299017573mm 
  this object is subsetable
  20.0161333333333mm extension on the right 

      name   annotation_type color_mapping height
    Tissue   discrete vector  user-defined    5mm
 Diagnosis   discrete vector  user-defined    5mm
       Age continuous vector  user-defined    5mm
       Sex   discrete vector  user-defined    5mm
      Race   discrete vector  user-defined    5mm
 TumorSite   discrete vector  user-defined    5mm

sessionInfo( )

R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] RSQLite_2.2.7         dplyr_1.0.7           WGCNA_1.70-3          fastcluster_1.2.3     dynamicTreeCut_1.63-1 concaveman_1.1.0      ggforce_0.3.3        
 [8] ggnewscale_0.4.5      ggnetwork_0.5.10      ggplot2_3.3.5         igraph_1.2.6          fs_1.5.0              data.table_1.14.0     rrvgo_1.2.0          
[15] randomcoloR_1.1.0.1   circlize_0.4.13       RColorBrewer_1.1-2    ComplexHeatmap_2.6.2  stringr_1.4.0         openxlsx_4.2.4        maftools_2.6.05      
[22] ExperimentHub_1.16.1  AnnotationHub_2.22.1  BiocFileCache_1.14.0  dbplyr_2.1.1          BiocGenerics_0.36.1  

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.3                R.methodsS3_1.8.1             ragg_1.1.3                    tidyr_1.1.3                   bit64_4.0.5                  
  [6] knitr_1.33                    DelayedArray_0.16.3           R.utils_2.10.1                rpart_4.1-15                  RCurl_1.98-1.3               
 [11] doParallel_1.0.16             generics_0.1.0                preprocessCore_1.52.1         cowplot_1.1.1                 chron_2.3-56                 
 [16] bit_4.0.4                     tzdb_0.1.2                    xml2_1.3.2                    lubridate_1.7.10              httpuv_1.6.1                 
 [21] SummarizedExperiment_1.20.0   assertthat_0.2.1              STRINGdb_2.2.2                xfun_0.24                     hms_1.1.0                    
 [26] evaluate_0.14                 promises_1.2.0.1              fansi_0.5.0                   progress_1.2.2                MAFDash_0.1.0                
 [31] caTools_1.18.2                DBI_1.1.1                     htmlwidgets_1.5.3             stats4_4.0.3                  purrr_0.3.4                  
 [36] hash_2.2.6.1                  ellipsis_0.3.2                corrplot_0.90                 crosstalk_1.1.1.9000          backports_1.2.1              
 [41] V8_3.4.2                      annotate_1.68.0               gridBase_0.4-7                biomaRt_2.46.3                MatrixGenerics_1.2.1         
 [46] vctrs_0.3.8                   Biobase_2.50.0                Cairo_1.5-12.2                withr_2.4.2                   cachem_1.0.5                 
 [51] treemap_2.4-2                 checkmate_2.0.0               prettyunits_1.1.1             MultiAssayExperiment_1.16.0   cluster_2.1.2                
 [56] lazyeval_0.2.2                crayon_1.4.1                  basilisk.utils_1.2.2          flexdashboard_0.5.2           genefilter_1.72.1            
 [61] edgeR_3.32.1                  labeling_0.4.2                slam_0.1-48                   pkgconfig_2.0.3               tweenr_1.0.2                 
 [66] GenomeInfoDb_1.26.7           wordcloud_2.6                 vipor_0.4.5                   nnet_7.3-16                   rlang_0.4.11                 
 [71] lifecycle_1.0.0               downloader_0.4                filelock_1.0.2                tcltk_4.0.3                   polyclip_1.10-0              
 [76] matrixStats_0.60.0            graph_1.68.0                  Matrix_1.3-4                  Rhdf5lib_1.12.1               base64enc_0.1-3              
 [81] beeswarm_0.4.0                GlobalOptions_0.1.2           pheatmap_1.0.12               png_0.1-7                     viridisLite_0.4.0            
 [86] rjson_0.2.20                  bitops_1.0-7                  R.oo_1.24.0                   KernSmooth_2.23-20            rhdf5filters_1.2.1           
 [91] MOFA_1.6.2                    blob_1.2.2                    TCGAbiolinks_2.18.0           shape_1.4.6                   readr_2.0.0                  
 [96] jpeg_0.1-9                    S4Vectors_0.28.1              scales_1.1.1                  memoise_2.0.0                 graphite_1.36.0              
[101] GSEABase_1.52.1               magrittr_2.0.1                plyr_1.8.6                    gplots_3.1.1                  zlibbioc_1.36.0              
[106] compiler_4.0.3                mogsa_1.24.0                  plotrix_3.8-1                 clue_0.3-59                   cli_3.0.1                    
[111] XVector_0.30.0                htmlTable_2.2.1               Formula_1.2-4                 MASS_7.3-54                   tidyselect_1.1.1             
[116] stringi_1.7.3                 forcats_0.5.1                 TCGAbiolinksGUI.data_1.10.0   textshaping_0.3.5             yaml_2.2.1                   
[121] GOSemSim_2.16.1               locfit_1.5-9.4                askpass_1.1                   latticeExtra_0.6-29           ggrepel_0.9.1                
[126] tools_4.0.3                   rstudioapi_0.13               canvasXpress_1.35.0           foreach_1.5.1                 foreign_0.8-81               
[131] gridExtra_2.3                 farver_2.1.0                  Rtsne_0.15                    digest_0.6.27                 BiocManager_1.30.16          
[136] shiny_1.6.0                   proto_1.0.0                   Rcpp_1.0.7                    GenomicRanges_1.42.0          MOFA2_1.0.1                  
[141] BiocVersion_3.12.0            later_1.2.0                   httr_1.4.2                    AnnotationDbi_1.52.0          colorspace_2.0-2             
[146] rvest_1.0.1                   XML_3.99-0.6                  reticulate_1.20               IRanges_2.24.1                splines_4.0.3                
[151] uwot_0.1.10                   basilisk_1.2.1                systemfonts_1.0.2             plotly_4.9.4.1                xtable_1.8-4                 
[156] jsonlite_1.7.2                corpcor_1.6.9                 NLP_0.2-1                     R6_2.5.0                      tm_0.7-8                     
[161] Hmisc_4.5-0                   gsubfn_0.7                    pillar_1.6.2                  htmltools_0.5.1.1             mime_0.11                    
[166] glue_1.4.2                    fastmap_1.1.0                 DT_0.18                       interactiveDisplayBase_1.28.0 codetools_0.2-18             
[171] utf8_1.2.2                    lattice_0.20-44               ensurer_1.1                   tibble_3.1.3                  sqldf_0.4-11                 
[176] curl_4.3.2                    bsplus_0.1.2                  svd_0.5                       ggbeeswarm_0.6.0              gtools_3.9.2                 
[181] zip_2.2.0                     GO.db_3.12.1                  openssl_1.4.4                 limma_3.46.0                  survival_3.2-11              
[186] rmarkdown_2.9                 munsell_0.5.0                 GetoptLong_1.0.5              rhdf5_2.34.0                  GenomeInfoDbData_1.2.4       
[191] iterators_1.0.13              HDF5Array_1.18.1              impute_1.64.0                 reshape2_1.4.4                gtable_0.3.0
ComplexHeatmap Anno Annotation • 2.6k views
ADD COMMENT
1
Entering edit mode

You can set simple_anno_size = unit(8, "mm"). If you set argument annotation_height, it should look like: annotation_height = unit(c(8,8,8,8,8,8), "mm").

ADD REPLY

Login before adding your answer.

Traffic: 605 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6