Browse code

add unit_to_numeric() function

jokergoo authored on 05/03/2020 14:31:53
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,34 +0,0 @@
1
-
2
-
3
-##### test anno_richtext ####
4
-anno = anno_text(month.name)
5
-
6
-anno = anno_richtext(richtext_grob(month.name, box_gp = gpar(col = "red"), rot = 90, hjust = 1, y = unit(1, "npc")))
7
-draw(anno, test = "month names")
8
-anno = anno_richtext(richtext_grob(month.name, box_gp = gpar(col = "red"), hjust = 0, x = unit(0, "npc")), which = "row")
9
-draw(anno, test = "month names")
10
-
11
-
12
-reprex({
13
-library(gridtext)
14
-library(grid)
15
-gb = richtext_grob(month.name, rot = 90, align_widths = FALSE)
16
-convertHeight(grobHeight(gb), "mm")
17
-gb = richtext_grob(month.name, rot = 90, align_widths = TRUE)
18
-convertHeight(grobHeight(gb), "mm")
19
-
20
-# only September
21
-gb = richtext_grob(month.name[9], rot = 90, align_widths = FALSE)
22
-convertHeight(grobHeight(gb), "mm")
23
-})
24
-
25
-m = matrix(rnorm(144), 12)
26
-rownames(m) = month.name
27
-colnames(m) = month.name
28
-
29
-Heatmap(m, row_labels = richtext_grob(rownames(m), align_widths = TRUE, box_gp = gpar(col = "red"), x = 0, hjust = 0),
30
-	column_labels = richtext_grob(colnames(m), box_gp = gpar(col = "blue"), y = 1, hjust = 1, rot = 90))
31
-
32
-
33
-
34
-Heatmap(m)
35 0
\ No newline at end of file
Browse code

anno_simple(): fixed a bug when all pch are NA in a slice

Zuguang Gu authored on 25/02/2020 14:51:37
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,34 @@
1
+
2
+
3
+##### test anno_richtext ####
4
+anno = anno_text(month.name)
5
+
6
+anno = anno_richtext(richtext_grob(month.name, box_gp = gpar(col = "red"), rot = 90, hjust = 1, y = unit(1, "npc")))
7
+draw(anno, test = "month names")
8
+anno = anno_richtext(richtext_grob(month.name, box_gp = gpar(col = "red"), hjust = 0, x = unit(0, "npc")), which = "row")
9
+draw(anno, test = "month names")
10
+
11
+
12
+reprex({
13
+library(gridtext)
14
+library(grid)
15
+gb = richtext_grob(month.name, rot = 90, align_widths = FALSE)
16
+convertHeight(grobHeight(gb), "mm")
17
+gb = richtext_grob(month.name, rot = 90, align_widths = TRUE)
18
+convertHeight(grobHeight(gb), "mm")
19
+
20
+# only September
21
+gb = richtext_grob(month.name[9], rot = 90, align_widths = FALSE)
22
+convertHeight(grobHeight(gb), "mm")
23
+})
24
+
25
+m = matrix(rnorm(144), 12)
26
+rownames(m) = month.name
27
+colnames(m) = month.name
28
+
29
+Heatmap(m, row_labels = richtext_grob(rownames(m), align_widths = TRUE, box_gp = gpar(col = "red"), x = 0, hjust = 0),
30
+	column_labels = richtext_grob(colnames(m), box_gp = gpar(col = "blue"), y = 1, hjust = 1, rot = 90))
31
+
32
+
33
+
34
+Heatmap(m)
0 35
\ No newline at end of file