Browse code

Merge pull request #520 from xiangpin/master

fix bug for geom_hilight when layout is daylight or graph layout function

Guangchuang Yu authored on 03/08/2022 15:20:37 • GitHub committed on 03/08/2022 15:20:37
Showing2 changed files

... ...
@@ -113,7 +113,7 @@ scale_x_range <- function() {
113 113
 ##' p2 + scale_x_continuous(labels=abs)
114 114
 ##' @author Guangchuang Yu
115 115
 revts <- function(treeview) {
116
-    if (attr(treeview$data, 'revts.done')){
116
+    if (!is.null(attr(treeview$data, 'revts.done'))){
117 117
          return(treeview)
118 118
     }
119 119
     x <- treeview$data$x
... ...
@@ -528,6 +528,9 @@ ggplot_add.hilight <- function(object, plot, object_name){
528 528
         if (flag_tbl_tree){
529 529
             object$data <-  object$data[,!colnames(object$data) %in% setdiff(flag_names, as_name(object$mapping$node)),drop=FALSE]
530 530
         }
531
+        object$data <- object$data[, !colnames(object$data) %in% setdiff(intersect(colnames(object$data), 
532
+                                                                     colnames(data)), 
533
+                                                                     as_name(object$mapping$node)), drop=FALSE]
531 534
         object$data <- merge(data, object$data, by.x="clade_root_node", by.y=as_name(object$mapping$node))
532 535
         object$data[[as_name(object$mapping$node)]] <- as.vector(object$data$clade_root_node)
533 536
         object$mapping <- object$mapping[!names(object$mapping) %in% c("node")]