Browse code

no anno_text

jokergoo authored on 16/11/2018 11:14:57
Showing2 changed files

... ...
@@ -1103,12 +1103,12 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1103 1103
 		data_scale = data_scale + c(-extend, 0)*(data_scale[2] - data_scale[1])
1104 1104
 		baseline = max(x)
1105 1105
 	} else {
1106
-		if(is.numeric(baseline) && is.null(ylim)) {
1106
+		if(is.numeric(baseline)) {
1107 1107
 			if(baseline == 0 && all(abs(rowSums(x) - 1) < 1e-6)) {
1108 1108
 				data_scale = c(0, 1)
1109
-			} else if(baseline <= min(x)) {
1109
+			} else if(baseline <= data_scale[1]) {
1110 1110
 				data_scale = c(baseline, extend*(data_scale[2] - baseline) + data_scale[2])
1111
-			} else if(baseline >= max(x)) {
1111
+			} else if(baseline >= data_scale[2]) {
1112 1112
 				data_scale = c(-extend*(baseline - data_scale[1]) + data_scale[1], baseline)
1113 1113
 			} else {
1114 1114
 				data_scale = data_scale + c(-extend, extend)*(data_scale[2] - data_scale[1])
... ...
@@ -521,7 +521,7 @@ Heatmap = function(matrix, col, name,
521 521
     .Object@row_names_param$rot = row_names_rot
522 522
     .Object@row_names_param$max_width = row_names_max_width + unit(2, "mm")
523 523
     # we use anno_text to draw row/column names because it already takes care of text rotation
524
-    if(length(row_labels)) {
524
+    if(show_row_names) {
525 525
         if(length(row_labels) != nrow(matrix)) {
526 526
             stop_wrap("Length of `row_labels` should be the same as the nrow of matrix.")
527 527
         }
... ...
@@ -540,7 +540,7 @@ Heatmap = function(matrix, col, name,
540 540
     .Object@column_names_param$gp = check_gp(column_names_gp)
541 541
     .Object@column_names_param$rot = column_names_rot
542 542
     .Object@column_names_param$max_height = column_names_max_height + unit(2, "mm")
543
-    if(length(column_labels)) {
543
+    if(show_column_names) {
544 544
         if(length(column_labels) != ncol(matrix)) {
545 545
             stop_wrap("Length of `column_labels` should be the same as the ncol of matrix.")
546 546
         }