ComplexHeatmap icon indicating copy to clipboard operation
ComplexHeatmap copied to clipboard

changing font size of labels of column annotations

Open reg321 opened this issue 1 year ago • 2 comments

Hello, Thank you for the great package. I am trying to change the font size of the labels of the column annotations without success. Here is an example:

set.seed(123)
M<-matrix(rnorm(36),nrow=6) dimnames(M) <- list(rownames(M, do.NULL = FALSE, prefix = "row"),colnames(M, do.NULL = FALSE, prefix = "col")) columnAnnot <- data.frame(group=c(rep("group1",3),rep("group2",3))) rownames(columnAnnot) <- colnames(M) Ann.color.all <- list() Ann.color.all[[1]] <- c("green","yellow") names(Ann.color.all[[i]]) <- unique(columnAnnot[,1]) names(Ann.color.all)[i] <- colnames(columnAnnot)[I]

column_Annotation <- HeatmapAnnotation(df=columnAnnot,col=Ann.color.all)

h <- ComplexHeatmap::Heatmap(M, column_split = columnAnnot, cluster_columns = FALSE, show_row_dend = FALSE, show_row_names = TRUE, heatmap_legend_param = list(title = "Expression"), gap = unit(1,"mm"),
show_column_names = FALSE, top_annotation = column_Annotation, column_title_rot=angle_col, #can be 0 or 90 row_names_gp = grid::gpar(fontsize = rownames_font_size))

I am trying to change the font size of "group1" and "group2" above the green and yellow bars. Is this possible?

Thank you

reg321 avatar Jul 22 '23 06:07 reg321

And here is an image of the heatmap and the test that I am trying to change the font size: image

reg321 avatar Jul 22 '23 07:07 reg321

try changing annotation_name_gp= gpar(fontsize = 20), I think that also looking at section 3.14 on https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html might be helpful!

Christopher-Ng avatar Sep 02 '23 03:09 Christopher-Ng