Browse code

add message of graph layout

xiangpin authored on 10/12/2021 05:41:02
Showing3 changed files

... ...
@@ -45,7 +45,8 @@ Suggests:
45 45
     rmarkdown,
46 46
     stats,
47 47
     testthat,
48
-    tibble
48
+    tibble,
49
+    glue
49 50
 Remotes:
50 51
     GuangchuangYu/treeio
51 52
 VignetteBuilder: knitr
... ...
@@ -101,6 +101,8 @@ ggtree <- function(tr,
101 101
                 ...)
102 102
 
103 103
     if (!is.null(dd)){
104
+        message_wrap("The tree object will be displayed with graph layout since 
105
+                      layout argument was specified the graph layout function.")
104 106
         p$data <- dplyr::left_join(
105 107
                     p$data %>% select(-c("x", "y")), 
106 108
                     dd, 
... ...
@@ -117,6 +117,17 @@ getCols <- function (n) {
117 117
     grDevices::colorRampPalette(col3)(n)
118 118
 }
119 119
 
120
+message_wrap <- function(...){
121
+    msg <- .return_wrap(...)
122
+    message(msg)
123
+}
124
+
125
+.return_wrap <- function(...){
126
+    msg <- paste(..., collapse = "", sep = "")
127
+    wrapped <- strwrap(msg, width = getOption("width") - 2) %>%
128
+        glue::glue_collapse(., "\n", last = "\n")
129
+    wrapped
130
+}
120 131
 
121 132
 ##
122 133
 ##