Rotate annotation in Upset plot of complex heatmap package

436 Views Asked by At

I want to show the numbers of the bars in the top annotation barplot in the Upset plot of ComplexHeatmap. However, I could only find parameters to rotate the name of the annotations, but not the annotations themselfes.

Taken from the ComplexHeatmap Documentation:

lt = list(set1 = c("a", "b", "c"),
          set2 = c("b", "c", "d", "e"))
x = list_to_matrix(lt, universal_set = letters)
m2 = make_comb_mat(x)
m2 = m2[comb_degree(m2) > 0]
UpSet(m2, top_annotation = upset_top_annotation(m2, add_numbers = T))

Upset plot with rotated annotation

Is there a way to not have the numbers rotated by 45 degrees?

1

There are 1 best solutions below

1
Tyler On BEST ANSWER

You can do this by adding numbers_rot = 0 to the upset_top_annotation.

lt = list(set1 = c("a", "b", "c"),
          set2 = c("b", "c", "d", "e"))
x = list_to_matrix(lt, universal_set = letters)
m2 = make_comb_mat(x)
m2 = m2[comb_degree(m2) > 0]
UpSet(m2, top_annotation = upset_top_annotation(m2, add_numbers = T, numbers_rot = 0))

This option is somewhat hidden in the documentation, as it is not a parameter for upset_top_annotation, but gets passed to the anno_barplot. You can find more options to pass by looking at ?anno_barplot

Hope this helps!