我怎样才能使ggtree :: geom_range正常工作?

问题描述

我试图按照treedata book中的描述向节点添加范围条。这是我要达到的目标的一个示例:

trees with bars

注意红色条。

以下代码应创建带有红色条形的树图像:

library(tidyverse)
library(treeio)
library(ggtree)

# create a tree and add a numeric annotation called 'range'
tree = rtree(3) %>% as.treedata %>% as_tibble %>% 
  mutate(range=0.1) %>% 
  as.treedata

# plot the tree and add red bars with geom_bar()
ggtree(tree)  + geom_range(range='range',color="red")

tree without bars

但是,生成的图没有红色条。

我需要做什么才能向每个节点添加红色条形?

我正在使用ggtree v2.2.4,treeio v1.12.0和ggplot2 v3.3.2。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)