Browse code

remove gap in circular layout of gheatmap, #204

Guangchuang Yu authored on 17/10/2018 03:30:59
Showing 3 changed files

... ...
@@ -1,5 +1,7 @@
1 1
 # ggtree 1.13.6
2 2
 
3
++ set `scale_y_continuous(expand = c(0, 0))` for `gheatmap` when `colnames = FALSE` (2018-10-17, Wed)
4
+  - <https://github.com/GuangchuangYu/ggtree/issues/204>
3 5
 + made data usable with treedata in 'equal_angle' and 'daylight' layouts (2018-10-11, Thu)
4 6
   - <https://github.com/GuangchuangYu/ggtree/pull/201>
5 7
   
... ...
@@ -26,6 +26,7 @@
26 26
 ##' @importFrom ggplot2 guide_legend
27 27
 ##' @importFrom ggplot2 scale_fill_gradient
28 28
 ##' @importFrom ggplot2 scale_fill_discrete
29
+##' @importFrom ggplot2 scale_y_continuous
29 30
 ##' @export
30 31
 ##' @author Guangchuang Yu
31 32
 gheatmap <- function(p, data, offset=0, width=1, low="green", high="red", color="white",
... ...
@@ -109,6 +110,11 @@ gheatmap <- function(p, data, offset=0, width=1, low="green", high="red", color=
109 110
     p2 <- p2 + theme(legend.position="right", legend.title=element_blank())
110 111
     ## p2 <- p2 + guides(fill = guide_legend(override.aes = list(colour = NULL)))
111 112
 
113
+    if (!colnames) {
114
+        ## https://github.com/GuangchuangYu/ggtree/issues/204
115
+        p2 <- p2 + scale_y_continuous(expand = c(0,0))
116
+    }
117
+
112 118
     attr(p2, "mapping") <- mapping
113 119
     return(p2)
114 120
 }
... ...
@@ -64,6 +64,12 @@ __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for visuali
64 64
 
65 65
 ----------------------------------------------------------------------------------------
66 66
 
67
+## Authors
68
+
69
+Guangchuang YU <https://guangchuangyu.github.io>
70
+
71
+School of Basic Medical Sciences, Southern Medical University
72
+
67 73
 
68 74
 ### Citation
69 75