Browse code

add new argument 'beside' in 'anno_barplot()'

Zuguang Gu authored on 28/09/2021 11:13:16
Showing13 changed files

... ...
@@ -3,6 +3,7 @@ CHANGES in VERSION 2.9.4
3 3
 * fixed a bug of missing right annotation legends for vertically concatenated heatmaps.
4 4
 * `Legend()`: support `border` to be set to `asis`.
5 5
 * Rasterization: the default maximal size for temporary image is set to 30000 px (both for width and height).
6
+* add a new argument `beside` in `anno_barplot()` to position bars beside each other.
6 7
 
7 8
 ========================
8 9
 
... ...
@@ -1,32 +1,32 @@
1
-setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
2
-setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend'))
1
+setGeneric('row_order', function(object, ...) standardGeneric('row_order'))
2
+setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list'))
3
+setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
4
+setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
3 5
 setGeneric('draw', function(object, ...) standardGeneric('draw'))
4
-setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
5
-setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
6
+setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
6 7
 setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list'))
7
-setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
8 8
 setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
9
+setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
10
+setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
11
+setGeneric('row_dend', function(object, ...) standardGeneric('row_dend'))
9 12
 setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster'))
13
+setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
14
+setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
15
+setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
16
+setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
17
+setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
18
+setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
19
+setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
20
+setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
10 21
 setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width'))
11
-setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
12
-setGeneric('column_order', function(object, ...) standardGeneric('column_order'))
13
-setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list'))
22
+setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list'))
23
+setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
14 24
 setGeneric('draw_title', function(object, ...) standardGeneric('draw_title'))
25
+setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
15 26
 setGeneric('attach_annotation', function(object, ...) standardGeneric('attach_annotation'))
16
-setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
17
-setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
27
+setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
18 28
 setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height'))
19
-setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
20
-setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
29
+setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
21 30
 setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list'))
22
-setGeneric('row_dend', function(object, ...) standardGeneric('row_dend'))
23
-setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
24
-setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
25
-setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
26
-setGeneric('row_order', function(object, ...) standardGeneric('row_order'))
27
-setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
28
-setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
29
-setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
30
-setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
31
-setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list'))
32
-setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
31
+setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend'))
32
+setGeneric('column_order', function(object, ...) standardGeneric('column_order'))
... ...
@@ -1190,6 +1190,7 @@ anno_lines = function(x, which = c("column", "row"), border = TRUE, gp = gpar(),
1190 1190
 # -which Whether it is a column annotation or a row annotation?
1191 1191
 # -border Wether draw borders of the annotation region?
1192 1192
 # -bar_width Relative width of the bars. The value should be smaller than one.
1193
+# -beside When ``x`` is a matrix, will bars be positioned beside each other or as stacked bars?
1193 1194
 # -gp Graphic parameters for bars. The length of each graphic parameter can be 1, length of ``x`` if ``x``
1194 1195
 #     is a vector, or number of columns of ``x`` is ``x`` is a matrix.
1195 1196
 # -ylim Data ranges. By default it is ``range(x)`` if ``x`` is a vector, or ``range(rowSums(x))`` if ``x`` is a matrix.
... ...
@@ -1218,7 +1219,7 @@ anno_lines = function(x, which = c("column", "row"), border = TRUE, gp = gpar(),
1218 1219
 # m = t(apply(m, 1, function(x) x/sum(x)))
1219 1220
 # anno = anno_barplot(m, gp = gpar(fill = 2:5), bar_width = 1, height = unit(6, "cm"))
1220 1221
 # draw(anno, test = "proportion matrix")
1221
-anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_width = 0.6,
1222
+anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_width = 0.6, beside = FALSE,
1222 1223
 	gp = gpar(fill = "#CCCCCC"), ylim = NULL, extend = 0.05, axis = TRUE, 
1223 1224
 	axis_param = default_axis_param(which), 
1224 1225
 	add_numbers = FALSE, numbers_gp = gpar(fontsize = 8), 
... ...
@@ -1255,7 +1256,11 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1255 1256
 		gp = gpar(fill = grey(seq(0, 1, length = nc+2))[-c(1, nc+2)])
1256 1257
 	}
1257 1258
 
1258
-	data_scale = range(rowSums(x, na.rm = TRUE), na.rm = TRUE)
1259
+	if(beside) {
1260
+		data_scale = range(x, na.rm = TRUE)
1261
+	} else {
1262
+		data_scale = range(rowSums(x, na.rm = TRUE), na.rm = TRUE)
1263
+	}
1259 1264
 	if(!is.null(ylim)) data_scale = ylim
1260 1265
 	if(baseline == "min") {
1261 1266
 		data_scale = data_scale + c(0, extend)*(data_scale[2] - data_scale[1])
... ...
@@ -1265,7 +1270,7 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1265 1270
 		baseline = max(x)
1266 1271
 	} else {
1267 1272
 		if(is.numeric(baseline)) {
1268
-			if(baseline == 0 && all(abs(rowSums(x) - 1) < 1e-6)) {
1273
+			if(baseline == 0 && all(abs(rowSums(x) - 1) < 1e-6) && !beside) {
1269 1274
 				data_scale = c(0, 1)
1270 1275
 			} else if(baseline <= data_scale[1]) {
1271 1276
 				data_scale = c(baseline, extend*(data_scale[2] - baseline) + data_scale[2])
... ...
@@ -1348,16 +1353,32 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1348 1353
 				}
1349 1354
 			}
1350 1355
 		} else {
1351
-			for(i in seq_len(ncol(value))) {
1352
-				if(axis_param$direction == "normal") {
1353
-					width = abs(value[index, i])
1354
-					x_coor = rowSums(value[index, seq_len(i-1), drop = FALSE]) + width/2
1355
-					grid.rect(x = x_coor, y = n - seq_along(index) + 1, width = abs(width), height = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1356
-				} else {
1357
-					width = value_origin[index, i] # the original width
1358
-					x_coor = rowSums(value_origin[index, seq_len(i-1), drop = FALSE]) + width/2 #distance to the right
1359
-					x_coor = data_scale[2] - x_coor + data_scale[1]
1360
-					grid.rect(x = x_coor, y = n - seq_along(index) + 1, width = abs(width), height = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1356
+			if(beside) {
1357
+				nbar = ncol(value)
1358
+				nr = nrow(value)
1359
+				for(i in seq_along(index)) {
1360
+			        for(j in 1:nbar) {
1361
+			        	if(axis_param$direction == "normal") {
1362
+				        	grid.rect(x = baseline, y = nr-i+0.5 + (j-0.5)/nbar, width = value[index[i], j], height = 1/nbar*bar_width, just = c("left"),
1363
+				        		default.units = "native", gp = subset_gp(gp, j))
1364
+				        } else {
1365
+				        	grid.rect(x = baseline, y = nr-i+0.5 + (j-0.5)/nbar, width = value[index[i], j], height = 1/nbar*bar_width, just = c("right"),
1366
+				        		default.units = "native", gp = subset_gp(gp, j))
1367
+				        }
1368
+			        }
1369
+			    }
1370
+			} else {
1371
+				for(i in seq_len(ncol(value))) {
1372
+					if(axis_param$direction == "normal") {
1373
+						width = abs(value[index, i])
1374
+						x_coor = rowSums(value[index, seq_len(i-1), drop = FALSE]) + width/2
1375
+						grid.rect(x = x_coor, y = n - seq_along(index) + 1, width = abs(width), height = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1376
+					} else {
1377
+						width = value_origin[index, i] # the original width
1378
+						x_coor = rowSums(value_origin[index, seq_len(i-1), drop = FALSE]) + width/2 #distance to the right
1379
+						x_coor = data_scale[2] - x_coor + data_scale[1]
1380
+						grid.rect(x = x_coor, y = n - seq_along(index) + 1, width = abs(width), height = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1381
+					}
1361 1382
 				}
1362 1383
 			}
1363 1384
 		}
... ...
@@ -1397,16 +1418,32 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1397 1418
 				}
1398 1419
 			}
1399 1420
 		} else {
1400
-			for(i in seq_len(ncol(value))) {
1401
-				if(axis_param$direction == "normal") {
1402
-					height = value[index, i]
1403
-					y_coor = rowSums(value[index, seq_len(i-1), drop = FALSE]) + height/2
1404
-					grid.rect(y = y_coor, x = seq_along(index), height = abs(height), width = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1405
-				} else {
1406
-					height = value_origin[index, i]
1407
-					y_coor = rowSums(value_origin[index, seq_len(i-1), drop = FALSE]) + height/2
1408
-					y_coor = data_scale[2] - y_coor + data_scale[1]
1409
-					grid.rect(y = y_coor, x = seq_along(index), height = abs(height), width = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1421
+			if(beside) {
1422
+				nbar = ncol(value)
1423
+				nr = nrow(value)
1424
+				for(i in seq_along(index)) {
1425
+			        for(j in 1:nbar) {
1426
+			        	if(axis_param$direction == "normal") {
1427
+				        	grid.rect(y = baseline, x = nr-i+0.5 + (j-0.5)/nbar, height = value[index[i], j], width = 1/nbar*bar_width, just = c("bottom"),
1428
+				        		default.units = "native", gp = subset_gp(gp, j))
1429
+				        } else {
1430
+				        	grid.rect(y = baseline, x = nr-i+0.5 + (j-0.5)/nbar, height = value[index[i], j], width = 1/nbar*bar_width, just = c("top"),
1431
+				        		default.units = "native", gp = subset_gp(gp, j))
1432
+				        }
1433
+			        }
1434
+			    }
1435
+			} else {
1436
+				for(i in seq_len(ncol(value))) {
1437
+					if(axis_param$direction == "normal") {
1438
+						height = value[index, i]
1439
+						y_coor = rowSums(value[index, seq_len(i-1), drop = FALSE]) + height/2
1440
+						grid.rect(y = y_coor, x = seq_along(index), height = abs(height), width = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1441
+					} else {
1442
+						height = value_origin[index, i]
1443
+						y_coor = rowSums(value_origin[index, seq_len(i-1), drop = FALSE]) + height/2
1444
+						y_coor = data_scale[2] - y_coor + data_scale[1]
1445
+						grid.rect(y = y_coor, x = seq_along(index), height = abs(height), width = 1*bar_width, default.units = "native", gp = subset_gp(gp, i))
1446
+					}
1410 1447
 				}
1411 1448
 			}
1412 1449
 		}
... ...
@@ -1435,7 +1472,7 @@ anno_barplot = function(x, baseline = 0, which = c("column", "row"), border = TR
1435 1472
 		height = anno_size$height,
1436 1473
 		n = n,
1437 1474
 		data_scale = data_scale,
1438
-		var_import = list(value, gp, border, bar_width, baseline, axis, axis_param, axis_grob, data_scale, add_numbers, numbers_gp, numbers_offset, numbers_rot)
1475
+		var_import = list(value, gp, border, bar_width, baseline, beside, axis, axis_param, axis_grob, data_scale, add_numbers, numbers_gp, numbers_offset, numbers_rot)
1439 1476
 	)
1440 1477
 
1441 1478
 	anno@subset_rule$value = subset_matrix_by_row
... ...
@@ -711,6 +711,7 @@ unify_mat_list = function(mat_list, default = 0) {
711 711
 # -type A vector of the alteration types in the data. It can be a subset of all alteration types if you don't want to show them all.
712 712
 # -which Is it a row annotation or a column annotation?
713 713
 # -bar_width Width of the bars.
714
+# -beside Will bars be stacked or be positioned beside each other?
714 715
 # -ylim Data range.
715 716
 # -show_fraction Whether to show the numbers or the fractions?
716 717
 # -axis Whether draw axis?
... ...
@@ -726,7 +727,7 @@ unify_mat_list = function(mat_list, default = 0) {
726 727
 # Zuguang Gu <z.gu@dkfz.de>
727 728
 #
728 729
 anno_oncoprint_barplot = function(type = NULL, which = c("column", "row"),
729
-	bar_width = 0.6, ylim = NULL, show_fraction = FALSE, axis = TRUE,
730
+	bar_width = 0.6, beside = FALSE, ylim = NULL, show_fraction = FALSE, axis = TRUE,
730 731
 	axis_param = if(which == "column") default_axis_param("column") else list(side = "top", labels_rot = 0),
731 732
 	width = NULL, height = NULL, border = FALSE) {
732 733
 
... ...
@@ -761,7 +762,7 @@ anno_oncoprint_barplot = function(type = NULL, which = c("column", "row"),
761 762
 		v = v[, !is.na(col), drop = FALSE]
762 763
 		col = col[!is.na(col)]
763 764
 		fun = anno_barplot(v, gp = gpar(fill = col, col = NA), which = "column", ylim = ylim,
764
-			baseline = 0, height = anno_size$height, border = border, bar_width = bar_width,
765
+			baseline = 0, height = anno_size$height, border = border, bar_width = bar_width, beside = beside,
765 766
 			axis = axis, axis_param = axis_param)@fun
766 767
 		fun(index, k, n)
767 768
 	}
... ...
@@ -788,7 +789,7 @@ anno_oncoprint_barplot = function(type = NULL, which = c("column", "row"),
788 789
 		v = v[, !is.na(col), drop = FALSE]
789 790
 		col = col[!is.na(col)]
790 791
 		fun = anno_barplot(v, gp = gpar(fill = col, col = NA), which = "row", ylim = ylim,
791
-			baseline = 0, width = anno_size$width, border = border, bar_width = bar_width,
792
+			baseline = 0, width = anno_size$width, border = border, bar_width = bar_width, beside = beside,
792 793
 			axis = axis, axis_param = axis_param)@fun
793 794
 		fun(index, k, n)
794 795
 	}
... ...
@@ -805,7 +806,7 @@ anno_oncoprint_barplot = function(type = NULL, which = c("column", "row"),
805 806
 		which = which,
806 807
 		width = anno_size$width,
807 808
 		height = anno_size$height,
808
-		var_import = list(border, type, bar_width, axis, axis_param, anno_size, ylim, show_fraction)
809
+		var_import = list(border, type, bar_width, beside, axis, axis_param, anno_size, ylim, show_fraction)
809 810
 	)
810 811
 		
811 812
 	anno@subsetable = TRUE
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{add_heatmap}.
10 10
 \code{add_heatmap} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14 13
 \item \code{\link{add_heatmap,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
14
+\item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15 15
 \item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap-class}} class method
16 16
 }
17 17
 }
... ...
@@ -7,7 +7,7 @@ Barplot Annotation
7 7
 Barplot Annotation
8 8
 }
9 9
 \usage{
10
-anno_barplot(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_width = 0.6,
10
+anno_barplot(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_width = 0.6, beside = FALSE,
11 11
     gp = gpar(fill = "#CCCCCC"), ylim = NULL, extend = 0.05, axis = TRUE,
12 12
     axis_param = default_axis_param(which),
13 13
     add_numbers = FALSE, numbers_gp = gpar(fontsize = 8),
... ...
@@ -21,6 +21,7 @@ anno_barplot(x, baseline = 0, which = c("column", "row"), border = TRUE, bar_wid
21 21
   \item{which}{Whether it is a column annotation or a row annotation?}
22 22
   \item{border}{Wether draw borders of the annotation region?}
23 23
   \item{bar_width}{Relative width of the bars. The value should be smaller than one.}
24
+  \item{beside}{When \code{x} is a matrix, will bars be positioned beside each other or as stacked bars?}
24 25
   \item{gp}{Graphic parameters for bars. The length of each graphic parameter can be 1, length of \code{x} if \code{x} is a vector, or number of columns of \code{x} is \code{x} is a matrix.}
25 26
   \item{ylim}{Data ranges. By default it is \code{range(x)} if \code{x} is a vector, or \code{range(rowSums(x))} if \code{x} is a matrix.}
26 27
   \item{extend}{The extension to both side of \code{ylim}. The value is a percent value corresponding to \code{ylim[2] - ylim[1]}.}
... ...
@@ -8,7 +8,7 @@ Barplot Annotation for oncoPrint
8 8
 }
9 9
 \usage{
10 10
 anno_oncoprint_barplot(type = NULL, which = c("column", "row"),
11
-    bar_width = 0.6, ylim = NULL, show_fraction = FALSE, axis = TRUE,
11
+    bar_width = 0.6, beside = FALSE, ylim = NULL, show_fraction = FALSE, axis = TRUE,
12 12
     axis_param = if(which == "column") default_axis_param("column") else list(side = "top", labels_rot = 0),
13 13
     width = NULL, height = NULL, border = FALSE)
14 14
 }
... ...
@@ -17,6 +17,7 @@ anno_oncoprint_barplot(type = NULL, which = c("column", "row"),
17 17
   \item{type}{A vector of the alteration types in the data. It can be a subset of all alteration types if you don't want to show them all.}
18 18
   \item{which}{Is it a row annotation or a column annotation?}
19 19
   \item{bar_width}{Width of the bars.}
20
+  \item{beside}{Will bars be stacked or be positioned beside each other?}
20 21
   \item{ylim}{Data range.}
21 22
   \item{show_fraction}{Whether to show the numbers or the fractions?}
22 23
   \item{axis}{Whether draw axis?}
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{component_height}.
10 10
 \code{component_height} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{component_height,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{component_height,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{component_height,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{copy_all}.
10 10
 \code{copy_all} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{copy_all,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
14 13
 \item \code{\link{copy_all,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
14
+\item \code{\link{copy_all,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,12 +10,12 @@ Method dispatch page for \code{draw}.
10 10
 \code{draw} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method
14 13
 \item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15 14
 \item \code{\link{draw,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
16
-\item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
17 15
 \item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method
18 16
 \item \code{\link{draw,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
17
+\item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method
18
+\item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{make_layout}.
10 10
 \code{make_layout} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{make_layout,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{make_layout,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{make_layout,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -10,12 +10,12 @@ Method dispatch page for \code{show}.
10 10
 \code{show} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
14 13
 \item \code{\link{show,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
15
-\item \code{\link{show,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
16
-\item \code{\link{show,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method
17 14
 \item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15
+\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
16
+\item \code{\link{show,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method
18 17
 \item \code{\link{show,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18
+\item \code{\link{show,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{
... ...
@@ -262,6 +262,16 @@ anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), which = "row", axis_param = l
262 262
 draw(anno, test = "a vector")
263 263
 
264 264
 
265
+anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), beside = TRUE)
266
+draw(anno, test = "a matrix")
267
+draw(anno[1:5], test = "a matrix, subset")
268
+anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), beside = TRUE, which = "row")
269
+draw(anno, test = "a matrix, on rows")
270
+anno = anno_barplot(matrix(nc = 2, c(1:10, 10:1)), beside = TRUE, gp = gpar(fill = 2:3, col = 2:3))
271
+draw(anno, test = "a matrix with fill")
272
+
273
+
274
+
265 275
 ##### test anno_boxplot #####
266 276
 set.seed(123)
267 277
 m = matrix(rnorm(100), 10)