Browse code

vignettes added

Zuguang Gu authored on 30/10/2018 22:32:01
Showing19 changed files

... ...
@@ -153,6 +153,7 @@ export("dendrogramGrob")
153 153
 export("densityHeatmap")
154 154
 export("dist2")
155 155
 export("getXY_in_parent_vp")
156
+export("grid.annotation_axis")
156 157
 export("grid.boxplot")
157 158
 export("grid.dendrogram")
158 159
 export("ht_global_opt")
... ...
@@ -1,31 +1,31 @@
1
+setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
2
+setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height'))
3
+setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
4
+setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
5
+setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
6
+setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
7
+setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
8
+setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list'))
9
+setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
1 10
 setGeneric('make_column_cluster', function(object, ...) standardGeneric('make_column_cluster'))
2
-setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
3
-setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
4 11
 setGeneric('column_dend', function(object, ...) standardGeneric('column_dend'))
5
-setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
6
-setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
7
-setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width'))
8
-setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
9
-setGeneric('make_layout', function(object, ...) standardGeneric('make_layout'))
10
-setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
11 12
 setGeneric('row_order', function(object, ...) standardGeneric('row_order'))
12
-setGeneric('draw_heatmap_body', function(object, ...) standardGeneric('draw_heatmap_body'))
13
-setGeneric('heatmap_legend_size', function(object, ...) standardGeneric('heatmap_legend_size'))
14
-setGeneric('set_component_height', function(object, ...) standardGeneric('set_component_height'))
15
-setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
16 13
 setGeneric('draw_heatmap_list', function(object, ...) standardGeneric('draw_heatmap_list'))
17
-setGeneric('draw', function(object, ...) standardGeneric('draw'))
18
-setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
19
-setGeneric('color_mapping_legend', function(object, ...) standardGeneric('color_mapping_legend'))
20
-setGeneric('re_size', function(object, ...) standardGeneric('re_size'))
21 14
 setGeneric('row_dend', function(object, ...) standardGeneric('row_dend'))
22
-setGeneric('get_legend_param_list', function(object, ...) standardGeneric('get_legend_param_list'))
23
-setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list'))
24
-setGeneric('draw_title', function(object, ...) standardGeneric('draw_title'))
25
-setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
26
-setGeneric('component_height', function(object, ...) standardGeneric('component_height'))
27
-setGeneric('map_to_colors', function(object, ...) standardGeneric('map_to_colors'))
15
+setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
16
+setGeneric('set_component_width', function(object, ...) standardGeneric('set_component_width'))
28 17
 setGeneric('column_order', function(object, ...) standardGeneric('column_order'))
18
+setGeneric('draw_annotation_legend', function(object, ...) standardGeneric('draw_annotation_legend'))
29 19
 setGeneric('draw_heatmap_legend', function(object, ...) standardGeneric('draw_heatmap_legend'))
20
+setGeneric('annotation_legend_size', function(object, ...) standardGeneric('annotation_legend_size'))
21
+setGeneric('draw_annotation', function(object, ...) standardGeneric('draw_annotation'))
22
+setGeneric('prepare', function(object, ...) standardGeneric('prepare'))
23
+setGeneric('draw_dimnames', function(object, ...) standardGeneric('draw_dimnames'))
24
+setGeneric('draw', function(object, ...) standardGeneric('draw'))
25
+setGeneric('draw_title', function(object, ...) standardGeneric('draw_title'))
26
+setGeneric('make_row_cluster', function(object, ...) standardGeneric('make_row_cluster'))
27
+setGeneric('component_width', function(object, ...) standardGeneric('component_width'))
28
+setGeneric('get_color_mapping_list', function(object, ...) standardGeneric('get_color_mapping_list'))
29
+setGeneric('draw_dend', function(object, ...) standardGeneric('draw_dend'))
30 30
 setGeneric('adjust_heatmap_list', function(object, ...) standardGeneric('adjust_heatmap_list'))
31
-setGeneric('add_heatmap', function(object, ...) standardGeneric('add_heatmap'))
31
+setGeneric('copy_all', function(object, ...) standardGeneric('copy_all'))
... ...
@@ -268,6 +268,7 @@ AnnotationFunction = function(fun, fun_name = "", which = c("column", "row"),
268 268
 # -k Current slice index.
269 269
 # -n Total number of slices.
270 270
 # -test Is it in test mode? The value can be logical or a text which is plotted as the title of plot.
271
+# -... Pass to `grid::viewport`.
271 272
 #
272 273
 # == detail
273 274
 # Normally it is called internally by the `SingleAnnotation-class`.
... ...
@@ -277,7 +278,7 @@ AnnotationFunction = function(fun, fun_name = "", which = c("column", "row"),
277 278
 # 
278 279
 setMethod(f = "draw",
279 280
 	signature = "AnnotationFunction",
280
-	definition = function(object, index, k = 1, n = 1, test = FALSE) {
281
+	definition = function(object, index, k = 1, n = 1, test = FALSE, ...) {
281 282
 		
282 283
 	if(is.character(test)) {
283 284
 		test2 = TRUE
... ...
@@ -302,7 +303,7 @@ setMethod(f = "draw",
302 303
     anno_width = object@width
303 304
 
304 305
     # names should be passed to the data viewport
305
-	pushViewport(viewport(width = anno_width, height = anno_height))
306
+	pushViewport(viewport(width = anno_width, height = anno_height, ...))
306 307
 	vp_name1 = current.viewport()$name
307 308
 	object@fun(index, k, n)
308 309
 	if(test2) {
... ...
@@ -310,7 +310,28 @@ setMethod(f = "draw_dimnames",
310 310
         "column" = object@column_order_list[[k]])
311 311
     
312 312
     pushViewport(viewport(name = paste(object@name, which, "names", k, sep = "_"), ...))
313
-    draw(anno, index = ind)
313
+    if(which == "row") {
314
+        if(object@row_names_param$side == "right" ) {
315
+            x = unit(0, "npc")
316
+            y = unit(0.5, "npc")
317
+            just = "left"
318
+        } else {
319
+            x = unit(1, "npc")
320
+            y = unit(0.5, "npc")
321
+            just = "right"
322
+        }
323
+    } else {
324
+        if(object@column_names_param$side == "top") {
325
+            x = unit(0.5, "npc")
326
+            y = unit(0, "npc")
327
+            just = "bottom"
328
+        } else {
329
+            x = unit(0.5, "npc")
330
+            y = unit(1, "npc")
331
+            just = "top"
332
+        }
333
+    }
334
+    draw(anno, index = ind, x = x, y = y, just = just)
314 335
     upViewport()
315 336
 })
316 337
 
... ...
@@ -106,7 +106,7 @@ SingleAnnotation = setClass("SingleAnnotation",
106 106
 # == seealso
107 107
 # There are following built-in annotation functions that can be directly used to generate complex annotations: 
108 108
 # `anno_simple`, `anno_points`, `anno_lines`, `anno_barplot`, `anno_histogram`, `anno_boxplot`, `anno_density`, `anno_text`,
109
-# `anno_joyplot`, `anno_horizon`, `anno_image`, `anno_lines` and `anno_mark`.
109
+# `anno_joyplot`, `anno_horizon`, `anno_image`, `anno_block`, `anno_summary` and `anno_mark`.
110 110
 # 
111 111
 # == value
112 112
 # A `SingleAnnotation-class` object.
... ...
@@ -23,7 +23,7 @@ The full documentations are available at https://jokergoo.github.io/ComplexHeatm
23 23
 
24 24
 ### Install
25 25
 
26
-`ComplexHeatmap` is available on [Bioconductor](http://www.bioconductor.org/packages/devel/bioc/html/ComplexHeatmap.html), you can intall it by:
26
+`ComplexHeatmap` is available on [Bioconductor](http://www.bioconductor.org/packages/devel/bioc/html/ComplexHeatmap.html), you can install it by:
27 27
 
28 28
 ```{r}
29 29
 source("http://bioconductor.org/biocLite.R")
... ...
@@ -71,7 +71,7 @@ are those created by annotation names and axes.
71 71
 \seealso{
72 72
 There are following built-in annotation functions that can be directly used to generate complex annotations: 
73 73
 \code{\link{anno_simple}}, \code{\link{anno_points}}, \code{\link{anno_lines}}, \code{\link{anno_barplot}}, \code{\link{anno_histogram}}, \code{\link{anno_boxplot}}, \code{\link{anno_density}}, \code{\link{anno_text}},
74
-\code{\link{anno_joyplot}}, \code{\link{anno_horizon}}, \code{\link{anno_image}}, \code{\link{anno_lines}} and \code{\link{anno_mark}}.
74
+\code{\link{anno_joyplot}}, \code{\link{anno_horizon}}, \code{\link{anno_image}}, \code{\link{anno_block}}, \code{\link{anno_summary}} and \code{\link{anno_mark}}.
75 75
 }
76 76
 \value{
77 77
 A \code{\link{SingleAnnotation-class}} object.
... ...
@@ -10,9 +10,9 @@ 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,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14
-\item \code{\link{add_heatmap,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
15 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
+\item \code{\link{add_heatmap,Heatmap-method}}, \code{\link{Heatmap-class}} class method
16 16
 }
17 17
 }
18 18
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{column_dend}.
10 10
 \code{column_dend} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{column_dend,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{column_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
... ...
@@ -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{
... ...
@@ -7,7 +7,7 @@ Draw the AnnotationFunction Object
7 7
 Draw the AnnotationFunction Object
8 8
 }
9 9
 \usage{
10
-\S4method{draw}{AnnotationFunction}(object, index, k = 1, n = 1, test = FALSE)
10
+\S4method{draw}{AnnotationFunction}(object, index, k = 1, n = 1, test = FALSE, ...)
11 11
 }
12 12
 \arguments{
13 13
 
... ...
@@ -16,6 +16,7 @@ Draw the AnnotationFunction Object
16 16
   \item{k}{Current slice index.}
17 17
   \item{n}{Total number of slices.}
18 18
   \item{test}{Is it in test mode? The value can be logical or a text which is plotted as the title of plot.}
19
+  \item{...}{Pass to \code{\link[grid]{viewport}}.}
19 20
 
20 21
 }
21 22
 \details{
... ...
@@ -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,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
14
-\item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 13
 \item \code{\link{draw,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
16 14
 \item \code{\link{draw,Legends-method}}, \code{\link{Legends-class}} class method
17
-\item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18 15
 \item \code{\link{draw,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
16
+\item \code{\link{draw,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
17
+\item \code{\link{draw,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
18
+\item \code{\link{draw,Heatmap-method}}, \code{\link{Heatmap-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{draw_title}.
10 10
 \code{draw_title} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{draw_title,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{draw_title,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{draw_title,Heatmap-method}}, \code{\link{Heatmap-class}} class method
15 15
 }
16 16
 }
17 17
 \examples{
18 18
new file mode 100644
... ...
@@ -0,0 +1,30 @@
1
+\name{grid.annotation_axis}
2
+\alias{grid.annotation_axis}
3
+\title{
4
+Draw Annotation Axis
5
+}
6
+\description{
7
+Draw Annotation Axis
8
+}
9
+\usage{
10
+grid.annotation_axis(at = NULL, labels = at, labels_rot = 0, gp = gpar(),
11
+    side = "left", facing = "outside")
12
+}
13
+\arguments{
14
+
15
+  \item{at}{Break values. If it is not specified, it is inferred from data scale in current viewport.}
16
+  \item{labels}{Corresponding labels.}
17
+  \item{labels_rot}{Rotations of labels.}
18
+  \item{gp}{Graphic parameters.}
19
+  \item{side}{side of the axis of the annotation viewport.}
20
+  \item{facing}{Facing of the axis.}
21
+
22
+}
23
+\details{
24
+It uses \code{\link{annotation_axis_grob}} to construct the grob object, then use \code{\link[grid]{grid.draw}}
25
+to draw the axis.
26
+}
27
+\examples{
28
+# See examples in `annotation_axis_grob`
29
+NULL
30
+}
... ...
@@ -10,8 +10,8 @@ Method dispatch page for \code{row_dend}.
10 10
 \code{row_dend} can be dispatched on following classes:
11 11
 
12 12
 \itemize{
13
-\item \code{\link{row_dend,Heatmap-method}}, \code{\link{Heatmap-class}} class method
14 13
 \item \code{\link{row_dend,HeatmapList-method}}, \code{\link{HeatmapList-class}} class method
14
+\item \code{\link{row_dend,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,ColorMapping-method}}, \code{\link{ColorMapping-class}} class method
14
+\item \code{\link{show,AnnotationFunction-method}}, \code{\link{AnnotationFunction-class}} class method
15
+\item \code{\link{show,HeatmapAnnotation-method}}, \code{\link{HeatmapAnnotation-class}} class method
15 16
 \item \code{\link{show,SingleAnnotation-method}}, \code{\link{SingleAnnotation-class}} class method
16
-\item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method
17 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
18
+\item \code{\link{show,Heatmap-method}}, \code{\link{Heatmap-class}} class method
19 19
 }
20 20
 }
21 21
 \examples{
... ...
@@ -4,7 +4,7 @@
4 4
 -->
5 5
 
6 6
 
7
-Difference to Older Versions of ComplexHeatmap
7
+Difference to Older Versions of ComplexHeatmap Package
8 8
 =================================================
9 9
 
10 10
 **Author**: Zuguang Gu ( z.gu@dkfz.de )
... ...
@@ -15,23 +15,14 @@ Difference to Older Versions of ComplexHeatmap
15 15
 
16 16
 ---------------------------------------
17 17
 
18
-```{r, echo = FALSE, message = FALSE}
19
-library(markdown)
20
-options(markdown.HTML.options = c(options('markdown.HTML.options')[[1]], "toc"))
21
-library(knitr)
22
-knitr::opts_chunk$set(
23
-    error = FALSE,
24
-    tidy  = FALSE,
25
-    message = FALSE,
26
-    fig.align = "center",
27
-    fig.width = 6,
28
-    fig.height = 6)
29
-options(markdown.HTML.stylesheet = "custom.css")
30
-options(width = 100)
31
-```
18
+<style type="text/css">
19
+h1, h2, h3, h4, h5 {
20
+    line-height: 120%;
21
+}
22
+</style>
32 23
 
33 24
 From version 2.0.0 of **ComplexHeatmap**, there are big changes to the older versions. The major
34
-functionalities are still the same, but still it is not 100% compatible. This vignette lists the
25
+functionalities are still the same, but it is not 100% compatible. This vignette lists the
35 26
 changes between the new and old versions.
36 27
 
37 28
 ## Heatmap() function
... ...
@@ -40,18 +31,18 @@ changes between the new and old versions.
40 31
   are renamed to `row_km` and `row_split`, although `km` and `split` are still usable.
41 32
 - A new argument `border` controls the border of the heatmap body. If heatmap is split into slices,
42 33
   all the slices will have borders.
43
-- Row title and column title allow background color by `column_title_gp = gpar(fill = ...)`.
44
-- `cluster_rows` and `cluster_columns` also allows objects which can be converted to `dendrogram`.
34
+- Row title and column title allow background color by e.g. `column_title_gp = gpar(fill = ...)`.
35
+- `cluster_rows` and `cluster_columns` also allow objects which can be converted to `dendrogram`.
45 36
 - If `cluster_rows` and `cluster_columns` are provided as clustering object, dendrogram reordering
46 37
   is turned off by default.
47
-- Add examples of how to integerat seriation
38
+- Add examples of how to integrate seriation.
48 39
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#heatmap-seriation)
49 40
 - Row names and column names allow rotation by `row_names_rot` and `column_names_rot`.
50 41
 - New arguments `row_labels` and `column_labels` which can be set to replace row names and column
51 42
   names on the heatmap.
52 43
 - When heatmap is split and clustering is performed, there is a parent dendrogram which is
53
-  calculated from mean value in slices and put on top of the children dendrograms. There is a dashed
54
-  line showing the part of the parent dendrogram and emphasize the dendrogram is combined from
44
+  calculated from mean values in slices and put on top of the children dendrograms. There is a dashed
45
+  line showing the part of the parent dendrogram and emphasizing the dendrogram is combined from
55 46
   several dendrograms.
56 47
 - Remove `combined_name_fun` argument and control the titles for the heatmap slices directly by
57 48
   `row_title` and `column_title`. The two arguments support a string template which is convinient to
... ...
@@ -60,12 +51,13 @@ changes between the new and old versions.
60 51
 - New argument `layer_fun` is a vectorized version of `cell_fun`. This functionality is too
61 52
   low-level and normally users will not use it.
62 53
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#customize-the-heatmap-body)
63
-- New argument: `width`, `heatmap_width`, `height`, `heatmap_height` to control the size of the
54
+- New arguments `width`, `heatmap_width`, `height`, `heatmap_height` to control the size of the
64 55
   heatmap.
65 56
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#size-of-the-heatmap)
66
-- New argument: `left_annotation` and `right_annotation`.
57
+- New arguments `left_annotation` and `right_annotation`, which means row annotations can be components
58
+  of the heatmap, just like column annotations.
67 59
 - Remove `top_annotation_height` and `bottom_annotation_height`. The height of annotations should be
68
-  set in `HeatmapAnnotation()` function.
60
+  set in `HeatmapAnnotation()` function now.
69 61
 
70 62
 ## HeatmapAnnotation() function
71 63
 
... ...
@@ -74,7 +66,7 @@ changes between the new and old versions.
74 66
 - Provide more annotation functions: `anno_empty()`, `anno_simple`, `anno_image()`, `anno_block()`,
75 67
   `anno_lines()`, `anno_joyplot()`, `anno_horizon()`, `anno_summary()`.
76 68
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html)
77
-- The size of the annotations are better to be set in the annotation function, e.g.
69
+- The size of the annotations are better to be set in the annotation functions, e.g.
78 70
   `anno_points(..., height = )`, but you can still set `annotation_height`.
79 71
 - The axis for the annotations (e.g. `anno_points()`, ...) can be controlled by the `axis_param`
80 72
   argument in the annotation function.
... ...
@@ -85,6 +77,8 @@ changes between the new and old versions.
85 77
   account for the layout of the final heatmap.
86 78
 - Two `HeatmapAnnotation` objects can be added as a single `HeatmapAnnotation` object by `c()`.
87 79
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html#heatmap-annotation-utility-function)
80
+- No need to use `row_anno_*()` functions, now `anno_*()` functions can automatically check whether
81
+  they are in column annotations or row annotations.
88 82
 
89 83
 ## A list of heatmaps
90 84
 
... ...
@@ -92,15 +86,15 @@ changes between the new and old versions.
92 86
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#vertical-concatenation)
93 87
 - More arguments for the main heatmap can be controlled directly in `draw()`.
94 88
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#control-main-heatmap-in-draw-function)
89
+- Global options can be temporarily set in `draw()`. (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#change-parameters-globally, the last paragraph.)
95 90
 - Annotations and column names are nicely adjusted.
96 91
   (https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#annotations-as-components-are-adjusted)
97 92
 
98 93
 ## Legends
99 94
 
100
-- Legends are reimplemented as a `gTree` object internally. `Legend()` and `packLegend()` all
101
-  returns a `Legends` object. This object can be treated as a graphic element and to draw by
102
-  specifying the positions of the legends on the plot.
103
-  (https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html)
95
+- Legends are re-implemented as a `gTree` object internally. `Legend()` and `packLegend()` all
96
+  returns a `Legends` object. This object can be treated as a single graphic element and can be drawn by
97
+  specifying the positions on the viewport. (https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html)
104 98
 - Positions of legend labels are automatically adjusted if they overlap.
105 99
 - A list of legends are automatically wrapped into multiple columns or rows if they are too long and
106 100
   exceed the plotting region.
... ...
@@ -109,18 +103,18 @@ changes between the new and old versions.
109 103
 
110 104
 - It automatially tests whether functions in `alter_fun` are vectorized.
111 105
 - The oncoPrint barplot annotations are now controlled by `anno_oncoprint_barplot()` and they are
112
-  basically normal heatmap annotations. Also axes is controlled in `anno_oncoprint_barplot()`.
106
+  basically normal heatmap annotations. Also axis is controlled in `anno_oncoprint_barplot()`.
113 107
 - `barplot_ignore` is removed and the subset of alterations in directly controlled in
114 108
   `anno_oncoprint_barplot()`.
115 109
 - Similar as `Heatmap()`, all the argument related to the size of annotations are removed and they
116 110
   should be set directly in `HeatmapAnnotation()` or `anno_oncoprint_barplot()`.
117 111
 - New arguments `remove_empty_rows` and `remove_empty_columns`. If the number of rows and columns
118
-  gets smaller, all the oncoPrint component (e.g. row names, annotations) will be adjusted as well.
112
+  gets smaller, all the oncoPrint components (e.g. row names, annotations) will be adjusted as well.
119 113
 - `oncoPrint()` now returns a `Heatmap` object which can be concatenated to other
120 114
   heatmaps/annotations horizontally or vertically.
121 115
 
122 116
 ## densityHeatmap() function
123 117
 
124
-- Columns can be clustered by the Kolmogorov-Smirnov statistic between distributions.
118
+- Columns can be clustered by the Kolmogorov-Smirnov distance between distributions.
125 119
 - `densityHeatmap()` returns a vertical heatmap that more heatmaps and annotations can concatenate
126 120
   to it vertically.
... ...
@@ -14,55 +14,66 @@ Most Probably Asked Questions
14 14
 
15 15
 ---------------------------------------
16 16
 
17
-```{r, echo = FALSE, message = FALSE}
18
-library(markdown)
19
-options(markdown.HTML.options = c(options('markdown.HTML.options')[[1]], "toc"))
20
-library(knitr)
21
-knitr::opts_chunk$set(
22
-    error = FALSE,
23
-    tidy  = FALSE,
24
-    message = FALSE,
25
-    fig.align = "center",
26
-    fig.width = 6,
27
-    fig.height = 6)
28
-options(markdown.HTML.stylesheet = "custom.css")
29
-options(width = 100)
30
-```
17
+<style type="text/css">
18
+h1, h2, h3, h4, h5 {
19
+    line-height: 120%;
20
+}
21
+</style>
31 22
 
32
-## There is no plot comming out after running `Heatmap()` function.
23
+### There is no plot comming out after running Heatmap() function.
33 24
 
34 25
 In this case, you need to use `draw()` function explicitly. See https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#plot-the-heatmap.
35 26
 
36
-## Retrieve orders and dendrograms.
27
+### Retrieve orders and dendrograms.
37 28
 
38
-For retrieving orders and dendrograms from a single heatmap, see https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#get-orders-and-dendrograms-from-heatmap.
29
+For retrieving orders and dendrograms from a single heatmap. See https://jokergoo.github.io/ComplexHeatmap-reference/book/a-single-heatmap.html#get-orders-and-dendrograms-from-heatmap.
39 30
 
40
-For retrieving orders and dendrograms from a list of heatmaps, see https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#get-orders-and-dendrograms.
31
+For retrieving orders and dendrograms from a list of heatmaps. See https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#get-orders-and-dendrograms-from-a-list-of-heatmaps.
41 32
 
42
-## How to control the style of legends.
33
+### How to control the style of legends?
43 34
 
44 35
 The style of legends can be controlled by `heatmap_legend_param` in `Heatmap()`, or
45 36
 `annotation_legend_param` in `HeatmapAnnotation()`. The parameters for controlling legends are those
46
-arguments in `Legend()` function, see
37
+arguments in `Legend()` function. See
47 38
 https://jokergoo.github.io/ComplexHeatmap-reference/book/legends.html#heatmap-and-annotation-legends.
48 39
 
49
-## Some text are cut by the plotting region
40
+### Some text are cut by the plotting region.
50 41
 
51 42
 The layout of the **ComplexHeatmap** is not perfect that it is still possible some of the text are
52
-drawn out of the plotting region. In this case, you set the `padding` argument in `draw()` function
53
-to increase the blank areas around the final plot.
43
+drawn out of the plotting region. In this case, you can set the `padding` argument in `draw()` function
44
+to increase the blank areas around the final plot. See https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#manually-increase-space-around-the-plot.
54 45
 
55
-## Can the heatmaps be added vertically?
46
+### Can the heatmaps be added vertically?
56 47
 
57
-Yes, use `%v%` instead of `+`.
48
+Yes, use `%v%` instead of `+`. See https://jokergoo.github.io/ComplexHeatmap-reference/book/a-list-of-heatmaps.html#vertical-concatenation.
58 49
 
59
-## Does Heatmap titles supports mathematical expression?
50
+### Does Heatmap title supports mathematical expression?
60 51
 
61 52
 Yes, all the text-related elements (e.g. titles, row names, legend titles, legend labels, ...) allow
62 53
 methematical expression.
63 54
 
64
-## I have many heatmaps and I want to put them into panels for a big figure for my paper.
55
+### I have many heatmaps and I want to put them into different panels for a big figure for my paper.
65 56
 
66 57
 You can set `newpage = FALSE` in `draw()` function and use `grid.layout()` to manage the layout of
67
-your panels. But I suggest more to use `grid.grabExpr()` to directly capture the output of the
58
+your panels. 
59
+
60
+```{r, eval = FALSE}
61
+pushViewport(viewport(layout = grid.layout(...)))
62
+pushViewport(viewport(layout.pos.row = ..., layout.pos.col = ...))
63
+draw(ht, newpage = FALSE) # or draw(ht_list, newpage = FALSE)
64
+popViewport()
65
+...
66
+```
67
+
68
+But I more suggest to use `grid.grabExpr()` to directly capture the output of the
68 69
 heatmap and later draw the whole plot as a single graphic element by `grid.draw()`.
70
+
71
+```{r, eval = FALSE}
72
+ht_grob = grid.grabExpr(draw(ht, ...))
73
+
74
+pushViewport(viewport(layout = grid.layout(...)))
75
+pushViewport(viewport(layout.pos.row = ..., layout.pos.col = ...))
76
+grid.draw(ht_grob)
77
+popViewport()
78
+...
79
+```