Browse code

fixed a bug where size of column titles was wrongly calculated

Zuguang Gu authored on 27/10/2022 09:23:08
Showing 2 changed files

... ...
@@ -2,6 +2,7 @@ CHANGES in VERSION 2.13.4
2 2
 
3 3
 * `anno_barplot()`: fixed a bug when split is set, the bars are wrongly plotted under besides = TRUE.
4 4
 * `anno_boxplot()`: add two new argumetn: `add_points` and `pt_gp`.
5
+* fixed a bug of size of column title wrongly calculated.
5 6
 
6 7
 ========================
7 8
 
... ...
@@ -97,12 +97,13 @@ setMethod(f = "make_layout",
97 97
         title_padding[1] = title_padding[1] + unit(5.5, "points") + 
98 98
             convertHeight(grobDescent(textGrob(label = "jA", gp = column_title_gp)), "inches")
99 99
     }
100
+
100 101
     if(length(column_title) > 0) {
101 102
         if(column_title_side == "top") {
102
-            object@layout$layout_size$column_title_top_height = grobHeight(textGrob(column_title, gp = column_title_gp, rot = column_title_rot)) + sum(title_padding)
103
+            object@layout$layout_size$column_title_top_height = max_text_height(column_title, gp = column_title_gp, rot = column_title_rot) + sum(title_padding)
103 104
             object@layout$layout_index = rbind(object@layout$layout_index, column_title_top = heatmap_layout_index("column_title_top"))
104 105
         } else {
105
-            object@layout$layout_size$column_title_bottom_height = grobHeight(textGrob(column_title, gp = column_title_gp, rot = column_title_rot)) + sum(title_padding)
106
+            object@layout$layout_size$column_title_bottom_height = max_text_height(column_title, gp = column_title_gp, rot = column_title_rot) + sum(title_padding)
106 107
             object@layout$layout_index = rbind(object@layout$layout_index, column_title_bottom = heatmap_layout_index("column_title_bottom"))
107 108
         }
108 109
         object@layout$graphic_fun_list = c(object@layout$graphic_fun_list, function(object) {