1

recently, I am using Complexheatmap package to make heatmaps in R. After I finished making and annotating the map, I want to further include a legend about the annotation meanings.

rnames <- c("+","+","+", "-", "-","δ","δ","δ","δ", "*","*","*","h","h","h","h","h","h","h","h","u","u","u","u","u","u")
ha = rowAnnotation(foo = anno_mark(at = c(1:3,4:5,6:9,10:12,13:20,21:26), 
                                   labels = rnames))
names(rnames) = unique(A)
ht = Heatmap(data2,
        name = "Occurance",
        cluster_rows = FALSE,
        cluster_columns = FALSE,
        column_title = "Amino Acid Occurance in Overlapped Region in LCD in Known RBP genes",
        row_title = "AA", 
        column_title_gp = gpar(fontsize = 20),
        row_title_gp = gpar(fontsize = 30),
        row_split = A,
        right_annotation = ha,
        row_names_side = "left",
        row_names_gp = gpar(fontsize = 15)
        )
ht

I have no idea how to make a legend using symbols only about the annotations. What I expect is a legend contains 6 symbols: +,-,δ,*,h,u, with corresponding meaning "Positive","Negative","Polar","Special","Hydrophobic" and "Unique". For example: (sorry for using code format, as I dont know why stackoverflow will format my symbols away)

TYPE
δ Polar
* Special
h Hydrophobic
u Unique
+ Positive
- Negative

Also, dont replace the original scale of "Occurance" legend scale. Can anyone help me to deal with this issue? enter image description here

Dr. Coke
  • 47
  • 5

0 Answers0