Browse code

anno_mark(): expression is correctly supported

Zuguang Gu authored on 02/06/2020 09:59:27
Showing2 changed files

... ...
@@ -7,6 +7,7 @@ CHANGES in VERSION 2.5.3
7 7
 * `default_col()`: print a message if there are outliers in the matrix.
8 8
 * `discrete_legend_body()`: adjust ncol and nrow if there are empty rows and columns in the layout.
9 9
 * `anno_image()`: fixed a bug that images are not reordered.
10
+* `anno_mark()`: now expression is correctly supported.
10 11
 
11 12
 ========================
12 13
 
... ...
@@ -2790,7 +2790,7 @@ anno_mark = function(at, labels, which = c("column", "row"),
2790 2790
 	n = length(at)
2791 2791
 	link_gp = recycle_gp(link_gp, n)
2792 2792
 	labels_gp = recycle_gp(labels_gp, n)
2793
-	labels2index = structure(seq_along(at), names = labels)
2793
+	labels2index = structure(seq_along(at), names = as.character(labels))
2794 2794
 	at2labels = structure(labels, names = at)
2795 2795
 
2796 2796
 	if(length(extend) == 1) extend = rep(extend, 2)
... ...
@@ -2825,8 +2825,8 @@ anno_mark = function(at, labels, which = c("column", "row"),
2825 2825
 		}
2826 2826
 		labels = rev(at2labels[as.character(at)])
2827 2827
 
2828
-		labels_gp = subset_gp(labels_gp, labels2index[labels])
2829
-		link_gp = subset_gp(link_gp, labels2index[labels])
2828
+		labels_gp = subset_gp(labels_gp, labels2index[as.character(labels)])
2829
+		link_gp = subset_gp(link_gp, labels2index[as.character(labels)])
2830 2830
 
2831 2831
 		if(is.null(.scale)) {
2832 2832
 			.scale = c(0.5, n+0.5)
... ...
@@ -2895,8 +2895,8 @@ anno_mark = function(at, labels, which = c("column", "row"),
2895 2895
 		}
2896 2896
 		labels = at2labels[as.character(at)]
2897 2897
 		
2898
-		labels_gp = subset_gp(labels_gp, labels2index[labels])
2899
-		link_gp = subset_gp(link_gp, labels2index[labels])
2898
+		labels_gp = subset_gp(labels_gp, labels2index[as.character(labels)])
2899
+		link_gp = subset_gp(link_gp, labels2index[as.character(labels)])
2900 2900
 
2901 2901
 		if(is.null(.scale)) {
2902 2902
 			.scale = c(0.5, n+0.5)