Browse code

text positions are correctly calculated when rotating text in anno_mark()

Zuguang Gu authored on 19/10/2019 19:52:36
Showing1 changed files

... ...
@@ -331,14 +331,15 @@ draw(ht_list, row_split = c(rep("a", 95), rep("b", 5)))
331 331
 
332 332
 
333 333
 grid.newpage()
334
-pushViewport(viewport(w = 0.9, h = 0.9))
334
+pushViewport(viewport(x = 0.45, w = 0.7, h = 0.95))
335 335
 h = unit(0, "mm")
336
-for(rot in seq(0, 360, by = 30)) {
336
+for(rot in seq(0, 360, by = 30)[-13]) {
337 337
 	anno = anno_mark(at = c(1:4, 20, 60, 97:100), labels = strrep(letters[1:10], 4), labels_rot = rot, which = "column", side = "bottom")
338 338
 	h = h + height(anno)
339 339
 	pushViewport(viewport(y = h, height = height(anno), just = "top"))
340 340
 	grid.rect()
341 341
 	draw(anno, index = 1:100)
342
+	grid::grid.text(qq("labels_rot = @{rot}"), unit(1, "npc") + unit(2, "mm"), just = "left")
342 343
 	popViewport()
343 344
 }
344 345