Commit id: 1d5cea822fed8ed91d7ead49f520f719b3fecfd9
refreshed documentations
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ComplexHeatmap@105355 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -34,6 +34,7 @@ Zuguang Gu <z.gu@dkfz.de> |
34 | 34 |
|
35 | 35 |
} |
36 | 36 |
\examples{ |
37 |
+ |
|
37 | 38 |
# discrete color mapping for characters |
38 | 39 |
cm = ColorMapping(name = "test", |
39 | 40 |
colors = c("blue", "white", "red"), |
... | ... |
@@ -50,4 +51,6 @@ cm |
50 | 51 |
require(circlize) |
51 | 52 |
cm = ColorMapping(name = "test", |
52 | 53 |
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))) |
53 |
-cm} |
|
54 |
+cm |
|
55 |
+ |
|
56 |
+} |
... | ... |
@@ -111,6 +111,7 @@ Zuguang Gu <z.gu@dkfz.de> |
111 | 111 |
|
112 | 112 |
} |
113 | 113 |
\examples{ |
114 |
+ |
|
114 | 115 |
mat = matrix(rnorm(80, 2), 8, 10) |
115 | 116 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
116 | 117 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -181,4 +182,6 @@ Heatmap(mat, rect_gp = gpar(col = "white"), |
181 | 182 |
grid.text(mat[i, j], x = x, y = y) |
182 | 183 |
}, |
183 | 184 |
cluster_rows = FALSE, cluster_columns = FALSE, row_names_side = "left", |
184 |
- column_names_side = "top")} |
|
185 |
+ column_names_side = "top") |
|
186 |
+ |
|
187 |
+} |
... | ... |
@@ -46,6 +46,7 @@ Zuguang Gu <z.gu@dkfz.de> |
46 | 46 |
|
47 | 47 |
} |
48 | 48 |
\examples{ |
49 |
+ |
|
49 | 50 |
df = data.frame(type = c("a", "a", "a", "b", "b", "b")) |
50 | 51 |
ha = HeatmapAnnotation(df = df) |
51 | 52 |
|
... | ... |
@@ -59,4 +60,6 @@ ha = HeatmapAnnotation(points = anno_points(1:6)) |
59 | 60 |
ha = HeatmapAnnotation(histogram = anno_points(1:6)) |
60 | 61 |
|
61 | 62 |
mat = matrix(rnorm(36), 6) |
62 |
-ha = HeatmapAnnotation(boxplot = anno_boxplot(mat))} |
|
63 |
+ha = HeatmapAnnotation(boxplot = anno_boxplot(mat)) |
|
64 |
+ |
|
65 |
+} |
... | ... |
@@ -68,6 +68,7 @@ Zuguang Gu <z.gu@dkfz.de> |
68 | 68 |
|
69 | 69 |
} |
70 | 70 |
\examples{ |
71 |
+ |
|
71 | 72 |
mat = matrix(rnorm(80, 2), 8, 10) |
72 | 73 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
73 | 74 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -83,4 +84,6 @@ ht + ht_list |
83 | 84 |
ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), |
84 | 85 |
which = "row") |
85 | 86 |
ht + ha |
86 |
-ht_list + ha} |
|
87 |
+ht_list + ha |
|
88 |
+ |
|
89 |
+} |
... | ... |
@@ -48,6 +48,7 @@ Zuguang Gu <z.gu@dkfz.de> |
48 | 48 |
|
49 | 49 |
} |
50 | 50 |
\examples{ |
51 |
+ |
|
51 | 52 |
# discrete character |
52 | 53 |
SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b")) |
53 | 54 |
SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b"), |
... | ... |
@@ -63,4 +64,6 @@ SingleAnnotation(value = 1:10) |
63 | 64 |
SingleAnnotation(value = 1:10, col = colorRamp2(c(1, 10), c("blue", "red"))) |
64 | 65 |
|
65 | 66 |
# self-defined graphic function |
66 |
-SingleAnnotation(fun = anno_points(1:10))} |
|
67 |
+SingleAnnotation(fun = anno_points(1:10)) |
|
68 |
+ |
|
69 |
+} |
... | ... |
@@ -31,6 +31,7 @@ Zuguang Gu <z.gu@dkfz.de> |
31 | 31 |
|
32 | 32 |
} |
33 | 33 |
\examples{ |
34 |
+ |
|
34 | 35 |
mat = matrix(rnorm(80, 2), 8, 10) |
35 | 36 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
36 | 37 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -48,4 +49,6 @@ ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), |
48 | 49 |
ht + ha |
49 | 50 |
ht_list + ha |
50 | 51 |
|
51 |
-ha + ha + ht} |
|
52 |
+ha + ha + ht |
|
53 |
+ |
|
54 |
+} |
... | ... |
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de> |
28 | 28 |
|
29 | 29 |
} |
30 | 30 |
\examples{ |
31 |
+ |
|
31 | 32 |
mat = matrix(rnorm(80, 2), 8, 10) |
32 | 33 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
33 | 34 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -38,4 +39,6 @@ add_heatmap(ht, ht) |
38 | 39 |
|
39 | 40 |
ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), |
40 | 41 |
which = "row") |
41 |
-add_heatmap(ht, ha)} |
|
42 |
+add_heatmap(ht, ha) |
|
43 |
+ |
|
44 |
+} |
... | ... |
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de> |
28 | 28 |
|
29 | 29 |
} |
30 | 30 |
\examples{ |
31 |
+ |
|
31 | 32 |
mat = matrix(rnorm(80, 2), 8, 10) |
32 | 33 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
33 | 34 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -37,4 +38,6 @@ ht = Heatmap(mat) |
37 | 38 |
|
38 | 39 |
ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), |
39 | 40 |
which = "row") |
40 |
-add_heatmap(ha, ht)} |
|
41 |
+add_heatmap(ha, ht) |
|
42 |
+ |
|
43 |
+} |
... | ... |
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de> |
28 | 28 |
|
29 | 29 |
} |
30 | 30 |
\examples{ |
31 |
+ |
|
31 | 32 |
mat = matrix(rnorm(80, 2), 8, 10) |
32 | 33 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
33 | 34 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -39,4 +40,6 @@ add_heatmap(ht_list, ht) |
39 | 40 |
|
40 | 41 |
ha = HeatmapAnnotation(points = anno_points(1:12, which = "row"), |
41 | 42 |
which = "row") |
42 |
-add_heatmap(ht_list, ha)} |
|
43 |
+add_heatmap(ht_list, ha) |
|
44 |
+ |
|
45 |
+} |
... | ... |
@@ -32,6 +32,7 @@ Zuguang Gu <z.gu@dkfz.de> |
32 | 32 |
|
33 | 33 |
} |
34 | 34 |
\examples{ |
35 |
+ |
|
35 | 36 |
mat = matrix(rnorm(32), nrow = 4) |
36 | 37 |
f = anno_boxplot(mat) |
37 | 38 |
grid.newpage(); f(1:8) |
... | ... |
@@ -41,4 +42,6 @@ grid.newpage(); f(1:4) |
41 | 42 |
|
42 | 43 |
lt = lapply(1:4, function(i) rnorm(8)) |
43 | 44 |
f = anno_boxplot(lt) |
44 |
-grid.newpage(); f(1:4)} |
|
45 |
+grid.newpage(); f(1:4) |
|
46 |
+ |
|
47 |
+} |
... | ... |
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de> |
28 | 28 |
|
29 | 29 |
} |
30 | 30 |
\examples{ |
31 |
+ |
|
31 | 32 |
mat = matrix(rnorm(32), nrow = 4) |
32 | 33 |
f = anno_density(mat) |
33 | 34 |
grid.newpage(); f(1:8) |
... | ... |
@@ -37,4 +38,6 @@ grid.newpage(); f(1:4) |
37 | 38 |
|
38 | 39 |
lt = lapply(1:4, function(i) rnorm(8)) |
39 | 40 |
f = anno_density(lt, type = "heatmap") |
40 |
-grid.newpage(); f(1:4)} |
|
41 |
+grid.newpage(); f(1:4) |
|
42 |
+ |
|
43 |
+} |
... | ... |
@@ -26,6 +26,7 @@ Zuguang Gu <z.gu@dkfz.de> |
26 | 26 |
|
27 | 27 |
} |
28 | 28 |
\examples{ |
29 |
+ |
|
29 | 30 |
mat = matrix(rnorm(32), nrow = 4) |
30 | 31 |
f = anno_histogram(mat) |
31 | 32 |
grid.newpage(); f(1:8) |
... | ... |
@@ -35,4 +36,6 @@ grid.newpage(); f(1:4) |
35 | 36 |
|
36 | 37 |
lt = lapply(1:4, function(i) rnorm(8)) |
37 | 38 |
f = anno_histogram(lt) |
38 |
-grid.newpage(); f(1:4)} |
|
39 |
+grid.newpage(); f(1:4) |
|
40 |
+ |
|
41 |
+} |
... | ... |
@@ -29,9 +29,12 @@ Zuguang Gu <z.gu@dkfz.de> |
29 | 29 |
|
30 | 30 |
} |
31 | 31 |
\examples{ |
32 |
+ |
|
32 | 33 |
mat = matrix(rnorm(100), 10) |
33 | 34 |
colnames(mat) = letters[1:10] |
34 | 35 |
rownames(mat) = LETTERS[1:10] |
35 | 36 |
long_cn = do.call("paste0", rep(list(colnames(mat)), 4)) # just to construct long text |
36 | 37 |
ha_rot_cn = HeatmapAnnotation(text = anno_text(long_cn, rot = 45, offset = unit(5, "mm"))) |
37 |
-Heatmap(mat, name = "foo", top_annotation = ha_rot_cn, top_annotation_height = unit(1.2, "cm"))} |
|
38 |
+Heatmap(mat, name = "foo", top_annotation = ha_rot_cn, top_annotation_height = unit(1.2, "cm")) |
|
39 |
+ |
|
40 |
+} |
... | ... |
@@ -38,6 +38,7 @@ Zuguang Gu <z.gu@dkfz.de> |
38 | 38 |
|
39 | 39 |
} |
40 | 40 |
\examples{ |
41 |
+ |
|
41 | 42 |
# discrete color mapping for characters |
42 | 43 |
cm = ColorMapping(name = "test", |
43 | 44 |
colors = c("blue", "white", "red"), |
... | ... |
@@ -57,4 +58,6 @@ require(circlize) |
57 | 58 |
cm = ColorMapping(name = "test", |
58 | 59 |
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))) |
59 | 60 |
grid.newpage() |
60 |
-color_mapping_legend(cm, legend_title_gp = gpar(fontsize = 16))} |
|
61 |
+color_mapping_legend(cm, legend_title_gp = gpar(fontsize = 16)) |
|
62 |
+ |
|
63 |
+} |
... | ... |
@@ -20,6 +20,7 @@ This function is only for internal use. |
20 | 20 |
|
21 | 21 |
} |
22 | 22 |
\section{Detials}{ |
23 |
+ |
|
23 | 24 |
This function is only for internal use.} |
24 | 25 |
\value{ |
25 | 26 |
A \code{\link[grid]{unit}} object. |
... | ... |
@@ -30,4 +31,7 @@ Zuguang Gu <z.gu@dkfz.de> |
30 | 31 |
|
31 | 32 |
} |
32 | 33 |
\examples{ |
33 |
-# no example for this internal method} |
|
34 |
+ |
|
35 |
+# no example for this internal method |
|
36 |
+ |
|
37 |
+} |
... | ... |
@@ -30,6 +30,7 @@ Zuguang Gu <z.gu@dkfz.de> |
30 | 30 |
|
31 | 31 |
} |
32 | 32 |
\examples{ |
33 |
+ |
|
33 | 34 |
mat = matrix(rnorm(40), nr = 4, ncol = 10) |
34 | 35 |
rownames(mat) = letters[1:4] |
35 | 36 |
colnames(mat) = letters[1:10] |
... | ... |
@@ -39,4 +40,6 @@ d2 = dist2(mat, pairwise_fun = function(x, y) 1 - cor(x, y)) |
39 | 40 |
d2 = dist2(mat, pairwise_fun = function(x, y) { |
40 | 41 |
l = is.na(x) & is.na(y) |
41 | 42 |
sqrt(sum((x[l] - y[l])^2)) |
42 |
-})} |
|
43 |
+}) |
|
44 |
+ |
|
45 |
+} |
... | ... |
@@ -31,10 +31,13 @@ Zuguang Gu <z.gu@dkfz.de> |
31 | 31 |
|
32 | 32 |
} |
33 | 33 |
\examples{ |
34 |
+ |
|
34 | 35 |
mat = matrix(rnorm(80, 2), 8, 10) |
35 | 36 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
36 | 37 |
rownames(mat) = letters[1:12] |
37 | 38 |
colnames(mat) = letters[1:10] |
38 | 39 |
|
39 | 40 |
ht = Heatmap(mat) |
40 |
-draw(ht, heatmap_legend_side = "left")} |
|
41 |
+draw(ht, heatmap_legend_side = "left") |
|
42 |
+ |
|
43 |
+} |
... | ... |
@@ -30,6 +30,7 @@ Zuguang Gu <z.gu@dkfz.de> |
30 | 30 |
|
31 | 31 |
} |
32 | 32 |
\examples{ |
33 |
+ |
|
33 | 34 |
df = data.frame(type = c("a", "a", "a", "b", "b", "b")) |
34 | 35 |
ha = HeatmapAnnotation(df = df) |
35 | 36 |
grid.newpage(); draw(ha, 1:6) |
... | ... |
@@ -50,4 +51,6 @@ grid.newpage(); draw(ha, 1:6) |
50 | 51 |
|
51 | 52 |
mat = matrix(rnorm(36), 6) |
52 | 53 |
ha = HeatmapAnnotation(boxplot = anno_boxplot(mat)) |
53 |
-grid.newpage(); draw(ha, 1:6)} |
|
54 |
+grid.newpage(); draw(ha, 1:6) |
|
55 |
+ |
|
56 |
+} |
... | ... |
@@ -33,6 +33,7 @@ Zuguang Gu <z.gu@dkfz.de> |
33 | 33 |
|
34 | 34 |
} |
35 | 35 |
\examples{ |
36 |
+ |
|
36 | 37 |
mat = matrix(rnorm(80, 2), 8, 10) |
37 | 38 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
38 | 39 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -42,4 +43,6 @@ ht = Heatmap(mat) |
42 | 43 |
ht_list = ht + ht |
43 | 44 |
draw(ht_list) |
44 | 45 |
draw(ht_list, row_title = "row title", column_title = "column title", |
45 |
- heatmap_legend_side = "top")} |
|
46 |
+ heatmap_legend_side = "top") |
|
47 |
+ |
|
48 |
+} |
... | ... |
@@ -31,6 +31,7 @@ Zuguang Gu <z.gu@dkfz.de> |
31 | 31 |
|
32 | 32 |
} |
33 | 33 |
\examples{ |
34 |
+ |
|
34 | 35 |
anno = SingleAnnotation(name = "test", value = c("a", "a", "a", "b", "b", "b")) |
35 | 36 |
grid.newpage(); draw(anno, 1:5) |
36 | 37 |
grid.newpage(); draw(anno, c(1, 4, 3, 5, 2)) |
... | ... |
@@ -52,4 +53,6 @@ anno = SingleAnnotation(value = 1:10, col = colorRamp2(c(1, 10), c("blue", "red" |
52 | 53 |
grid.newpage(); draw(anno, 1:10) |
53 | 54 |
|
54 | 55 |
anno = SingleAnnotation(fun = anno_points(1:10)) |
55 |
-grid.newpage(); draw(anno, 1:10)} |
|
56 |
+grid.newpage(); draw(anno, 1:10) |
|
57 |
+ |
|
58 |
+} |
... | ... |
@@ -34,6 +34,7 @@ Zuguang Gu <z.gu@dkfz.de> |
34 | 34 |
|
35 | 35 |
} |
36 | 36 |
\examples{ |
37 |
+ |
|
37 | 38 |
hc = hclust(dist(USArrests[1:5, ])) |
38 | 39 |
dend = as.dendrogram(hc) |
39 | 40 |
|
... | ... |
@@ -45,4 +46,6 @@ grid.dendrogram(dend, facing = "top", layout.pos.row = 1, layout.pos.col = 2) |
45 | 46 |
grid.dendrogram(dend, facing = "top", order = "reverse", layout.pos.row = 2, |
46 | 47 |
layout.pos.col = 1) |
47 | 48 |
grid.dendrogram(dend, facing = "left", layout.pos.row = 2, layout.pos.col = 2) |
48 |
-upViewport()} |
|
49 |
+upViewport() |
|
50 |
+ |
|
51 |
+} |
... | ... |
@@ -29,6 +29,7 @@ Zuguang Gu <z.gu@dkfz.de> |
29 | 29 |
|
30 | 30 |
} |
31 | 31 |
\examples{ |
32 |
+ |
|
32 | 33 |
# discrete color mapping for characters |
33 | 34 |
cm = ColorMapping(name = "test", |
34 | 35 |
colors = c("blue", "white", "red"), |
... | ... |
@@ -49,4 +50,6 @@ require(circlize) |
49 | 50 |
cm = ColorMapping(name = "test", |
50 | 51 |
col_fun = colorRamp2(c(0, 0.5, 1), c("blue", "white", "red"))) |
51 | 52 |
map_to_colors(cm, 0.2) |
52 |
-map_to_colors(cm, seq(0.2, 0.8, by = 0.1))} |
|
53 |
+map_to_colors(cm, seq(0.2, 0.8, by = 0.1)) |
|
54 |
+ |
|
55 |
+} |
... | ... |
@@ -46,6 +46,7 @@ Zuguang Gu <z.gu@dkfz.de> |
46 | 46 |
|
47 | 47 |
} |
48 | 48 |
\examples{ |
49 |
+ |
|
49 | 50 |
df = data.frame(matrix(rnorm(40), nrow = 10, dimnames = list(letters[1:10], letters[1:4])), |
50 | 51 |
large = runif(10)*100, |
51 | 52 |
t1 = sample(letters[1:3], 10, replace = TRUE), |
... | ... |
@@ -53,4 +54,6 @@ df = data.frame(matrix(rnorm(40), nrow = 10, dimnames = list(letters[1:10], lett |
53 | 54 |
t2 = sample(LETTERS[1:3], 10, replace = TRUE)) |
54 | 55 |
plotDataFrame(df) |
55 | 56 |
plotDataFrame(df, group = list(1:4, 5, 6, 7:12, 13), group_names = c("mat1", "large", "t1", "mat2", "t2"), |
56 |
- main_heatmap = 4, km = 2, column_title = "column title", row_title = "row title")} |
|
57 |
+ main_heatmap = 4, km = 2, column_title = "column title", row_title = "row title") |
|
58 |
+ |
|
59 |
+} |
... | ... |
@@ -28,6 +28,7 @@ Zuguang Gu <z.gu@dkfz.de> |
28 | 28 |
|
29 | 29 |
} |
30 | 30 |
\examples{ |
31 |
+ |
|
31 | 32 |
mat = matrix(rnorm(80, 2), 8, 10) |
32 | 33 |
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10)) |
33 | 34 |
rownames(mat) = letters[1:12] |
... | ... |
@@ -35,4 +36,6 @@ colnames(mat) = letters[1:10] |
35 | 36 |
|
36 | 37 |
ht = Heatmap(mat) |
37 | 38 |
ht |
38 |
-draw(ht, heatmap_legend_side = "left")} |
|
39 |
+draw(ht, heatmap_legend_side = "left") |
|
40 |
+ |
|
41 |
+} |