HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
67 stars 30 forks source link

Rotate left annotation on plotExprHeatmap #319

Closed david-priest closed 1 year ago

david-priest commented 1 year ago

Sorry for the somewhat specific question,

In plotExprHeatmap(), I have edited the Heatmap() to rotate the marker names using column_names_rot = 45. However as you can see from the attached screenshot, when plotting the left annotation, it's names are still vertical.

Could you provide a way to update left_anno to rotate it's names too? I know how to make a new annotation with rotated names HeatmapAnnotation(text = anno_text(cn, rot = 45, offset = unit(1, "npc"), just = "right"), annotation_height = max_text_width(cn))), but I don't know how to updateleft_anno. Trying to edit anno_factors() or anno_clusters() is going a bit deep for me. It would be good to know how to update an existing annotation object, e.g. to rotate the names.

Screenshot 2023-01-17 at 3 46 13 PM

HelenaLC commented 1 year ago

I think this should be posted to the ComplexHeatmap package, as it’s not related CATALYST specifically, but how to post-modify an object of the Heatmap class.

david-priest commented 1 year ago

Ok yes. I'll ask there.

david-priest commented 1 year ago

For a heatmap p, the left annotation column names can be rotated using

p@left_annotation@anno_list[[1]]@name_param$rot = 45
p@left_annotation@anno_list[[2]]@name_param$rot = 45

I also tried p@column_names_param$rot = 45, but it didn't seem to change their rotation.

Anyway, I hope this can help for general info about editing parameters of the heatmap outputted