Browse code

Commit made by the Bioconductor Git-SVN bridge.

Commit id: ff9ffa810ca9f16a253861d97301062962dbe38b

titles support expression now



git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ComplexHeatmap@106147 bc3139a8-67e5-0310-9ffc-ced21a209358

z.gu authored on 13/07/2015 21:26:16
Showing 64 changed files

... ...
@@ -1,6 +1,8 @@
1 1
 CHANGES in VERSION 1.2.4
2 2
 
3
-*  legend for continuous values can be set as continuous legends
3
+* legend for continuous values can be set as continuous legends
4
+* row title and column title as well as legend title support expression
5
+* add `heatmap_legend_title` in `Heatmap` and `ColorMapping`
4 6
 
5 7
 ==========================================
6 8
 
... ...
@@ -29,7 +29,8 @@ ColorMapping = setClass("ColorMapping",
29 29
 		type    = "character",  # continuous or discrete
30 30
 		name    = "character",  # used to map to the dataset and taken as the title of the legend
31 31
 		na_col  = "character",
32
-		color_bar = "character"
32
+		color_bar = "character",
33
+		legend_title = "ANY"
33 34
 	)
34 35
 )
35 36
 
... ...
@@ -47,6 +48,7 @@ ColorMapping = setClass("ColorMapping",
47 48
 # -enforce_breaks If it is set to `TRUE`, values of ``breaks`` will be the final break value in the legend.
48 49
 #            If it is ``FALSE``, proper breaks values will be automatically generated.
49 50
 # -na_col colors for ``NA`` values.
51
+# -legend_title title of the legend, by default it is the name of the legend
50 52
 # -color_bar if the color mapping is continuous, whether draw the legend discrete or continuous.
51 53
 #
52 54
 # == detail
... ...
@@ -61,7 +63,7 @@ ColorMapping = setClass("ColorMapping",
61 63
 #
62 64
 ColorMapping = function(name, colors = NULL, levels = NULL, 
63 65
 	col_fun = NULL, breaks = NULL, enforce_breaks = FALSE, na_col = "#FFFFFF",
64
-	color_bar = c("discrete", "continuous")) {
66
+	legend_title = name, color_bar = c("discrete", "continuous")) {
65 67
 
66 68
 	.Object = new("ColorMapping")
67 69
 
... ...
@@ -116,6 +118,7 @@ ColorMapping = function(name, colors = NULL, levels = NULL,
116 118
 	.Object@name = name
117 119
 	.Object@na_col = na_col
118 120
 
121
+	.Object@legend_title = legend_title
119 122
 	color_bar = match.arg(color_bar)[1]
120 123
 	if(.Object@type == "discrete" && color_bar == "continuous") {
121 124
 		stop("Continuous color bar can only be applied to continuous color mapping.")
... ...
@@ -245,7 +248,7 @@ setMethod(f = "color_mapping_legend",
245 248
 	color_bar = object@color_bar
246 249
 
247 250
 	# add title
248
-	legend_title_grob = textGrob(object@name, just = c("left", "top"), gp = legend_title_gp)
251
+	legend_title_grob = textGrob(object@legend_title, just = c("left", "top"), gp = legend_title_gp)
249 252
 	legend_title_height = grobHeight(legend_title_grob)
250 253
 	legend_title_width = grobWidth(legend_title_grob)
251 254
 
... ...
@@ -261,7 +264,7 @@ setMethod(f = "color_mapping_legend",
261 264
 	gf = frameGrob(layout = grid.layout(nr = 2, nc = 2, width = unit.c(legend_grid_width, grid_padding + legend_label_max_width),
262 265
 		                                                height = unit.c(legend_title_height, legend_padding + nlevel*(legend_grid_height))))
263 266
 	# legend title
264
-	gf = packGrob(gf, row = 1, col = 1:2, grob = textGrob(object@name, x = 0, y = 1, default.units = "npc", just = c("left", "top"), gp = legend_title_gp))
267
+	gf = packGrob(gf, row = 1, col = 1:2, grob = textGrob(object@legend_title, x = 0, y = 1, default.units = "npc", just = c("left", "top"), gp = legend_title_gp))
265 268
 	
266 269
 	# legend grid
267 270
 	x = unit(rep(0, nlevel), "npc")
... ...
@@ -68,11 +68,11 @@ Heatmap = setClass("Heatmap",
68 68
         matrix_param = "list",
69 69
         matrix_color_mapping = "ANY",
70 70
 
71
-        row_title = "character",
71
+        row_title = "ANY",
72 72
         row_title_rot = "numeric",
73 73
         row_title_just = "numeric",
74 74
         row_title_param = "list",
75
-        column_title = "character",
75
+        column_title = "ANY",
76 76
         column_title_param = "list",
77 77
         column_title_rot = "numeric",
78 78
         column_title_just = "numeric",
... ...
@@ -178,6 +178,7 @@ Heatmap = setClass("Heatmap",
178 178
 # -width the width of the single heatmap, should be a fixed `grid::unit` object. It is used for the layout when the heatmap
179 179
 #        is appended to a list of heatmaps.
180 180
 # -show_heatmap_legend whether show heatmap legend?
181
+# -heatmap_legend_title title for the heatmap legend. By default it is the name of the heatmap
181 182
 # -heatmap_legend_color_bar if the matrix is continuous, whether should the legend as continuous color bar as well?
182 183
 #
183 184
 # == details
... ...
@@ -225,6 +226,7 @@ Heatmap = function(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
225 226
     km = 1, split = NULL, gap = unit(1, "mm"), 
226 227
     combined_name_fun = function(x) paste(x, collapse = "/"),
227 228
     width = NULL, show_heatmap_legend = TRUE,
229
+    heatmap_legend_title = name,
228 230
     heatmap_legend_color_bar = c("discrete", "continuous")) {
229 231
 
230 232
     .Object = new("Heatmap")
... ...
@@ -301,31 +303,33 @@ Heatmap = function(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
301 303
             col = default_col(matrix, main_matrix = TRUE)
302 304
         }
303 305
         if(is.function(col)) {
304
-            .Object@matrix_color_mapping = ColorMapping(col_fun = col, name = name, na_col = na_col, color_bar = heatmap_legend_color_bar)
306
+            .Object@matrix_color_mapping = ColorMapping(col_fun = col, name = name, legend_title = heatmap_legend_title, na_col = na_col, color_bar = heatmap_legend_color_bar)
305 307
         } else {
306 308
             if(is.null(names(col))) {
307 309
                 if(length(col) == length(unique(matrix))) {
308 310
                     names(col) = unique(matrix)
309
-                    .Object@matrix_color_mapping = ColorMapping(colors = col, name = name, na_col = na_col, color_bar = heatmap_legend_color_bar)
311
+                    .Object@matrix_color_mapping = ColorMapping(colors = col, name = name, legend_title = heatmap_legend_title, na_col = na_col, color_bar = heatmap_legend_color_bar)
310 312
                 } else if(is.numeric(matrix)) {
311 313
                     col = colorRamp2(seq(min(matrix, na.rm = TRUE), max(matrix, na.rm = TRUE), length = length(col)),
312 314
                                      col)
313
-                    .Object@matrix_color_mapping = ColorMapping(col_fun = col, name = name, na_col = na_col, color_bar = heatmap_legend_color_bar)
315
+                    .Object@matrix_color_mapping = ColorMapping(col_fun = col, name = name, legend_title = heatmap_legend_title, na_col = na_col, color_bar = heatmap_legend_color_bar)
314 316
                 } else {
315 317
                     stop("`col` should have names to map to values in `mat`.")
316 318
                 }
317 319
             } else {
318
-                .Object@matrix_color_mapping = ColorMapping(colors = col, name = name, na_col = na_col, color_bar = heatmap_legend_color_bar)
320
+                .Object@matrix_color_mapping = ColorMapping(colors = col, name = name, legend_title = heatmap_legend_title, na_col = na_col, color_bar = heatmap_legend_color_bar)
319 321
             }
320 322
         }
321 323
     }
322 324
     
323 325
     if(length(row_title) == 0) {
324 326
         row_title = character(0)
325
-    } else if(is.na(row_title)) {
326
-        row_title = character(0)
327
-    } else if(row_title == "") {
328
-        row_title = character(0)
327
+    } else if(!inherits(row_title, "expression")) {
328
+            if(is.na(row_title)) {
329
+            row_title = character(0)
330
+        } else if(row_title == "") {
331
+            row_title = character(0)
332
+        }
329 333
     }
330 334
     .Object@row_title = row_title
331 335
     .Object@row_title_rot = row_title_rot %% 360
... ...
@@ -336,10 +340,12 @@ Heatmap = function(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
336 340
 
337 341
     if(length(column_title) == 0) {
338 342
         column_title = character(0)
339
-    } else if(is.na(column_title)) {
340
-        column_title = character(0)
341
-    } else if(column_title == "") {
342
-        column_title = character(0)
343
+    } else if(!inherits(column_title, "expression")) {
344
+            if(is.na(column_title)) {
345
+            column_title = character(0)
346
+        } else if(column_title == "") {
347
+            column_title = character(0)
348
+        }
343 349
     }
344 350
     .Object@column_title = column_title
345 351
     .Object@column_title_rot = column_title_rot %% 360
... ...
@@ -54,9 +54,9 @@ HeatmapList = setClass("HeatmapList",
54 54
         ht_list = "list",
55 55
         ht_list_param = "list",
56 56
 
57
-        row_title = "character",
57
+        row_title = "ANY",
58 58
         row_title_param = "list",
59
-        column_title = "character",
59
+        column_title = "ANY",
60 60
         column_title_param = "list",
61 61
 
62 62
         annotation_legend_param = "list",
... ...
@@ -368,10 +368,12 @@ setMethod(f = "make_layout",
368 368
     column_title_side = match.arg(column_title_side)[1]
369 369
     if(length(column_title) == 0) {
370 370
         column_title = character(0)
371
-    } else if(is.na(column_title)) {
372
-        column_title = character(0)
373
-    } else if(column_title == "") {
374
-        column_title = character(0)
371
+    } else if(!inherits(column_title, "expression")) {
372
+        if(is.na(column_title)) {
373
+            column_title = character(0)
374
+        } else if(column_title == "") {
375
+            column_title = character(0)
376
+        }
375 377
     }
376 378
     object@column_title = column_title
377 379
     object@column_title_param$gp = check_gp(column_title_gp)
... ...
@@ -392,10 +394,12 @@ setMethod(f = "make_layout",
392 394
     row_title_side = match.arg(row_title_side)[1]
393 395
     if(length(row_title) == 0) {
394 396
         row_title = character(0)
395
-    } else if(is.na(row_title)) {
396
-        row_title = character(0)
397
-    } else if(row_title == "") {
398
-        row_title = character(0)
397
+    } else if(!inherits(row_title, "expression")) { 
398
+        if(is.na(row_title)) {
399
+            row_title = character(0)
400
+        } else if(row_title == "") {
401
+            row_title = character(0)
402
+        }
399 403
     }
400 404
     object@row_title = row_title
401 405
     object@row_title_param$gp = check_gp(row_title_gp)
... ...
@@ -15,7 +15,5 @@ It is only designed for \code{+} generic method so that above three classes can
15 15
 
16 16
 }
17 17
 \examples{
18
-
19
-
20 18
 # no example
21 19
 NULL}
... ...
@@ -27,7 +27,5 @@ Zuguang Gu <z.gu@dkfz.de>
27 27
 
28 28
 }
29 29
 \examples{
30
-
31
-
32 30
 # no example
33 31
 NULL}
... ...
@@ -30,7 +30,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 # for examples, please go to `ColorMapping` method page
36 34
 NULL}
... ...
@@ -11,7 +11,7 @@ Constructor methods for ColorMapping class
11 11
 \usage{
12 12
 ColorMapping(name, colors = NULL, levels = NULL,
13 13
     col_fun = NULL, breaks = NULL, enforce_breaks = FALSE, na_col = "#FFFFFF",
14
-    color_bar = c("discrete", "continuous"))}
14
+    legend_title = name, color_bar = c("discrete", "continuous"))}
15 15
 \arguments{
16 16
 
17 17
   \item{name}{name for this color mapping. It is used for drawing the title of the legend.}
... ...
@@ -21,6 +21,7 @@ ColorMapping(name, colors = NULL, levels = NULL,
21 21
   \item{breaks}{breaks for the continuous color mapping. If \code{col_fun} isgenerated by \code{\link[circlize]{colorRamp2}}, \code{breaks} can be ignored.}
22 22
   \item{enforce_breaks}{If it is set to \code{\link{TRUE}}, values of \code{breaks} will be the final break value in the legend.If it is \code{FALSE}, proper breaks values will be automatically generated.}
23 23
   \item{na_col}{colors for \code{NA} values.}
24
+  \item{legend_title}{title of the legend, by default it is the name of the legend}
24 25
   \item{color_bar}{if the color mapping is continuous, whether draw the legend discrete or continuous.}
25 26
 }
26 27
 \details{
... ...
@@ -37,8 +38,6 @@ Zuguang Gu <z.gu@dkfz.de>
37 38
 
38 39
 }
39 40
 \examples{
40
-
41
-
42 41
 # discrete color mapping for characters
43 42
 cm = ColorMapping(name = "test",
44 43
     colors = c("blue", "white", "red"),
... ...
@@ -72,7 +72,5 @@ Zuguang Gu <z.gu@dkfz.de>
72 72
 
73 73
 }
74 74
 \examples{
75
-
76
-
77 75
 # for examples, please go to `Heatmap` method page
78 76
 NULL}
... ...
@@ -35,6 +35,7 @@ Heatmap(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
35 35
     km = 1, split = NULL, gap = unit(1, "mm"),
36 36
     combined_name_fun = function(x) paste(x, collapse = "/"),
37 37
     width = NULL, show_heatmap_legend = TRUE,
38
+    heatmap_legend_title = name,
38 39
     heatmap_legend_color_bar = c("discrete", "continuous"))}
39 40
 \arguments{
40 41
 
... ...
@@ -86,6 +87,7 @@ Heatmap(matrix, col, name, na_col = "grey", rect_gp = gpar(col = NA),
86 87
   \item{combined_name_fun}{if the heatmap is split by rows, how to make a combined row title for each slice?The input parameter for this function is a vector which contains level names under each column in \code{split}.}
87 88
   \item{width}{the width of the single heatmap, should be a fixed \code{\link[grid]{unit}} object. It is used for the layout when the heatmapis appended to a list of heatmaps.}
88 89
   \item{show_heatmap_legend}{whether show heatmap legend?}
90
+  \item{heatmap_legend_title}{title for the heatmap legend. By default it is the name of the heatmap}
89 91
   \item{heatmap_legend_color_bar}{if the matrix is continuous, whether should the legend as continuous color bar as well?}
90 92
 }
91 93
 \details{
... ...
@@ -113,8 +115,6 @@ Zuguang Gu <z.gu@dkfz.de>
113 115
 
114 116
 }
115 117
 \examples{
116
-
117
-
118 118
 mat = matrix(rnorm(80, 2), 8, 10)
119 119
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
120 120
 rownames(mat) = letters[1:12]
... ...
@@ -29,7 +29,5 @@ Zuguang Gu <z.gu@dkfz.de>
29 29
 
30 30
 }
31 31
 \examples{
32
-
33
-
34 32
 # for examples, please go to `HeatmapAnnotation` method page
35 33
 NULL}
... ...
@@ -48,8 +48,6 @@ Zuguang Gu <z.gu@dkfz.de>
48 48
 
49 49
 }
50 50
 \examples{
51
-
52
-
53 51
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
54 52
 ha = HeatmapAnnotation(df = df)
55 53
 
... ...
@@ -68,8 +68,6 @@ Zuguang Gu <z.gu@dkfz.de>
68 68
 
69 69
 }
70 70
 \examples{
71
-
72
-
73 71
 mat = matrix(rnorm(80, 2), 8, 10)
74 72
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
75 73
 rownames(mat) = letters[1:12]
... ...
@@ -27,11 +27,7 @@ Zuguang Gu <z.gu@dkfz.de>
27 27
 
28 28
 }
29 29
 \section{Detailes}{
30
-
31
-
32 30
 There is no public constructor method for the \code{\link{HeatmapList-class}}.}
33 31
 \examples{
34
-
35
-
36 32
 # no example
37 33
 NULL}
... ...
@@ -39,7 +39,5 @@ Zuguang Gu <z.gu@dkfz.de>
39 39
 
40 40
 }
41 41
 \examples{
42
-
43
-
44 42
 # for examples, please go to `SingleAnnotation` method page
45 43
 NULL}
... ...
@@ -49,8 +49,6 @@ Zuguang Gu <z.gu@dkfz.de>
49 49
 
50 50
 }
51 51
 \examples{
52
-
53
-
54 52
 # discrete character
55 53
 SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"))
56 54
 SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"), 
... ...
@@ -31,8 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 mat = matrix(rnorm(80, 2), 8, 10)
37 35
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
38 36
 rownames(mat) = letters[1:12]
... ...
@@ -28,8 +28,6 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 mat = matrix(rnorm(80, 2), 8, 10)
34 32
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
35 33
 rownames(mat) = letters[1:12]
... ...
@@ -28,8 +28,6 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 mat = matrix(rnorm(80, 2), 8, 10)
34 32
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
35 33
 rownames(mat) = letters[1:12]
... ...
@@ -28,8 +28,6 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 mat = matrix(rnorm(80, 2), 8, 10)
34 32
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
35 33
 rownames(mat) = letters[1:12]
... ...
@@ -31,8 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 f = anno_barplot(rnorm(10))
37 35
 grid.newpage(); f(1:10)
38 36
 
... ...
@@ -32,8 +32,6 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
-
36
-
37 35
 mat = matrix(rnorm(32), nrow = 4)
38 36
 f = anno_boxplot(mat)
39 37
 grid.newpage(); f(1:8)
... ...
@@ -28,8 +28,6 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 mat = matrix(rnorm(32), nrow = 4)
34 32
 f = anno_density(mat)
35 33
 grid.newpage(); f(1:8)
... ...
@@ -26,8 +26,6 @@ Zuguang Gu <z.gu@dkfz.de>
26 26
 
27 27
 }
28 28
 \examples{
29
-
30
-
31 29
 mat = matrix(rnorm(32), nrow = 4)
32 30
 f = anno_histogram(mat)
33 31
 grid.newpage(); f(1:8)
... ...
@@ -33,7 +33,5 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
-
37
-
38 36
 f = anno_points(rnorm(10))
39 37
 grid.newpage(); f(1:10)}
... ...
@@ -29,8 +29,6 @@ Zuguang Gu <z.gu@dkfz.de>
29 29
 
30 30
 }
31 31
 \examples{
32
-
33
-
34 32
 mat = matrix(rnorm(100), 10)
35 33
 colnames(mat) = letters[1:10]
36 34
 rownames(mat) = LETTERS[1:10]
... ...
@@ -33,7 +33,5 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
-
37
-
38 36
 # no example for this internal method
39 37
 NULL}
... ...
@@ -38,8 +38,6 @@ Zuguang Gu <z.gu@dkfz.de>
38 38
 
39 39
 }
40 40
 \examples{
41
-
42
-
43 41
 # discrete color mapping for characters
44 42
 cm = ColorMapping(name = "test",
45 43
     colors = c("blue", "white", "red"),
... ...
@@ -31,7 +31,5 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
37 35
 ha = rowAnnotation(df = df)}
... ...
@@ -28,6 +28,4 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 # no example for this internal method}
... ...
@@ -24,6 +24,4 @@ Zuguang Gu <z.gu@dkfz.de>
24 24
 
25 25
 }
26 26
 \examples{
27
-
28
-
29 27
 # no example for this internal method}
... ...
@@ -20,8 +20,6 @@ This function is only for internal use.
20 20
 
21 21
 }
22 22
 \section{Detials}{
23
-
24
-
25 23
 This function is only for internal use.}
26 24
 \value{
27 25
 A \code{\link[grid]{unit}} object.
... ...
@@ -32,6 +30,4 @@ Zuguang Gu <z.gu@dkfz.de>
32 30
 
33 31
 }
34 32
 \examples{
35
-
36
-
37 33
 # no example for this internal method}
... ...
@@ -28,6 +28,4 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 # no example for this internal method}
... ...
@@ -30,8 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 mat = matrix(rnorm(40), nr = 4, ncol = 10)
36 34
 rownames(mat) = letters[1:4]
37 35
 colnames(mat) = letters[1:10]
... ...
@@ -31,8 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 mat = matrix(rnorm(80, 2), 8, 10)
37 35
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
38 36
 rownames(mat) = letters[1:12]
... ...
@@ -30,8 +30,6 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
36 34
 ha = HeatmapAnnotation(df = df)
37 35
 grid.newpage(); draw(ha, 1:6)
... ...
@@ -33,8 +33,6 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
-
37
-
38 36
 mat = matrix(rnorm(80, 2), 8, 10)
39 37
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
40 38
 rownames(mat) = letters[1:12]
... ...
@@ -31,8 +31,6 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 anno = SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"))
37 35
 grid.newpage(); draw(anno, 1:5)
38 36
 grid.newpage(); draw(anno, c(1, 4, 3, 5, 2))
... ...
@@ -34,7 +34,5 @@ Zuguang Gu <z.gu@dkfz.de>
34 34
 
35 35
 }
36 36
 \examples{
37
-
38
-
39 37
 # no example for this internal method
40 38
 NULL}
... ...
@@ -32,7 +32,5 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
-
36
-
37 35
 # no example for this internal method
38 36
 NULL}
... ...
@@ -35,7 +35,5 @@ Zuguang Gu <z.gu@dkfz.de>
35 35
 
36 36
 }
37 37
 \examples{
38
-
39
-
40 38
 # no example for this internal method
41 39
 NULL}
... ...
@@ -42,7 +42,5 @@ Zuguang Gu <z.gu@dkfz.de>
42 42
 
43 43
 }
44 44
 \examples{
45
-
46
-
47 45
 # no example for this internal method
48 46
 NULL}
... ...
@@ -36,7 +36,5 @@ Zuguang Gu <z.gu@dkfz.de>
36 36
 
37 37
 }
38 38
 \examples{
39
-
40
-
41 39
 # no example for this internal method
42 40
 NULL}
... ...
@@ -32,7 +32,5 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
-
36
-
37 35
 # no example for this internal method
38 36
 NULL}
... ...
@@ -30,7 +30,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 # no example for this internal method
36 34
 NULL}
... ...
@@ -33,7 +33,5 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
-
37
-
38 36
 # no example for this internal method
39 37
 NULL}
... ...
@@ -31,7 +31,5 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 # no example for this internal method
37 35
 NULL}
... ...
@@ -30,7 +30,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 # no example for this internal method
36 34
 NULL}
... ...
@@ -34,8 +34,6 @@ Zuguang Gu <z.gu@dkfz.de>
34 34
 
35 35
 }
36 36
 \examples{
37
-
38
-
39 37
 hc = hclust(dist(USArrests[1:5, ]))
40 38
 dend = as.dendrogram(hc)
41 39
 
... ...
@@ -30,7 +30,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 # no example for this internal method
36 34
 NULL}
... ...
@@ -30,7 +30,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 # no example for this internal method
36 34
 NULL}
... ...
@@ -33,7 +33,5 @@ Zuguang Gu <z.gu@dkfz.de>
33 33
 
34 34
 }
35 35
 \examples{
36
-
37
-
38 36
 # no example for this internal method
39 37
 NULL}
... ...
@@ -59,7 +59,5 @@ Zuguang Gu <z.gu@dkfz.de>
59 59
 
60 60
 }
61 61
 \examples{
62
-
63
-
64 62
 # no example for this internal method
65 63
 NULL}
... ...
@@ -32,7 +32,5 @@ Zuguang Gu <z.gu@dkfz.de>
32 32
 
33 33
 }
34 34
 \examples{
35
-
36
-
37 35
 # no example for this internal method
38 36
 NULL}
... ...
@@ -29,8 +29,6 @@ Zuguang Gu <z.gu@dkfz.de>
29 29
 
30 30
 }
31 31
 \examples{
32
-
33
-
34 32
 # discrete color mapping for characters
35 33
 cm = ColorMapping(name = "test",
36 34
     colors = c("blue", "white", "red"),
... ...
@@ -25,7 +25,5 @@ This function returns no value.
25 25
 
26 26
 }
27 27
 \examples{
28
-
29
-
30 28
 # no example 
31 29
 NULL}
... ...
@@ -46,8 +46,6 @@ Zuguang Gu <z.gu@dkfz.de>
46 46
 
47 47
 }
48 48
 \examples{
49
-
50
-
51 49
 df = data.frame(matrix(rnorm(40), nrow = 10, dimnames = list(letters[1:10], letters[1:4])),
52 50
                 large = runif(10)*100,
53 51
                 t1 = sample(letters[1:3], 10, replace = TRUE),
... ...
@@ -37,7 +37,5 @@ Zuguang Gu <z.gu@dkfz.de>
37 37
 
38 38
 }
39 39
 \examples{
40
-
41
-
42 40
 # no example for this internal method
43 41
 NULL}
... ...
@@ -25,7 +25,5 @@ This function returns no value.
25 25
 
26 26
 }
27 27
 \examples{
28
-
29
-
30 28
 # no example 
31 29
 NULL}
... ...
@@ -31,7 +31,5 @@ Zuguang Gu <z.gu@dkfz.de>
31 31
 
32 32
 }
33 33
 \examples{
34
-
35
-
36 34
 df = data.frame(type = c("a", "a", "a", "b", "b", "b"))
37 35
 ha = columnAnnotation(df = df)}
... ...
@@ -30,7 +30,5 @@ Zuguang Gu <z.gu@dkfz.de>
30 30
 
31 31
 }
32 32
 \examples{
33
-
34
-
35 33
 # no example for this internal method
36 34
 NULL}
... ...
@@ -28,8 +28,6 @@ Zuguang Gu <z.gu@dkfz.de>
28 28
 
29 29
 }
30 30
 \examples{
31
-
32
-
33 31
 mat = matrix(rnorm(80, 2), 8, 10)
34 32
 mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
35 33
 rownames(mat) = letters[1:12]
... ...
@@ -24,6 +24,4 @@ This function returns no value.
24 24
 
25 25
 }
26 26
 \author{
27
-
28
-
29 27
 Zuguang Gu <z.gu@dkfz.de>}
... ...
@@ -690,7 +690,7 @@ draw(ht1 + ht2)
690 690
 ```
691 691
 
692 692
 **ComplexHeatmap** only generates legends for heatmaps and simple annotations. Self-defined legends
693
-can be passed by 1heatmap_legend_list` and `annotation_legend_list` as a list of `grob` objects.
693
+can be passed by `heatmap_legend_list` and `annotation_legend_list` as a list of `grob` objects.
694 694
 
695 695
 ```{r self_defined_annotation_legend, fig.width = 10}
696 696
 ha = HeatmapAnnotation(points = anno_points(rnorm(10)))
... ...
@@ -699,6 +699,13 @@ lgd = legendGrob(c("dots"), pch = 16)
699 699
 draw(ht1 + ht2, annotation_legend_list = list(lgd))
700 700
 ```
701 701
 
702
+Finally, you can change legend title for heatmap legend by specifying `heatmap_legend_title` in `Heatmap()`:
703
+
704
+```{r}
705
+ht1 = Heatmap(mat, name = "ht1", column_title = "Heatmap 1", heatmap_legend_title = expression(alpha))
706
+ht2 = Heatmap(mat, name = "ht2", column_title = "Heatmap 2", heatmap_legend_title = "HHHHH")
707
+draw(ht1 + ht2)
708
+```
702 709
 
703 710
 ### Gaps between heatmaps
704 711