Browse code

set max scale to 1 when dendrogram height is zero

Zuguang Gu authored on 08/09/2021 08:28:57
Showing 3 changed files

... ...
@@ -10,6 +10,7 @@ CHANGES in VERSION 2.9.3
10 10
 * `anno_barplot()`: allows to add numbers on top of bars.
11 11
 * `UpSet()`: axis labels are automatically formated for genomic coordinates.
12 12
 * `AnnotationFunction()`: add a new argument `cell_fun`.
13
+* When the dendrogram height is zero, the corresponding viewport has scale (0, 1).
13 14
 
14 15
 =========================
15 16
 
... ...
@@ -1389,6 +1389,7 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1389 1389
 				if(!is.null(attr(value, "labels_format"))) {
1390 1390
 					txt = attr(value, "labels_format")(value[index])
1391 1391
 				}
1392
+				numbers_rot = numbers_rot %% 360
1392 1393
 				if(numbers_rot == 0) {
1393 1394
 					grid.text(txt, x = seq_along(index), y = unit(baseline + height, "native") + numbers_offset, default.units = "native", gp = subset_gp(numbers_gp, index), just = c("bottom"))
1394 1395
 				} else {
... ...
@@ -363,6 +363,7 @@ setMethod(f = "draw_dend",
363 363
     if(is.null(max_height)) {
364 364
         max_height = dend_heights(dend)
365 365
     }
366
+    if(max_height == 0) max_height = 1
366 367
 
367 368
     if(side %in% c("left", "right")) {
368 369
         xscale = c(0, max_height)