Given this example from
here.
file <- system.file("extdata/BEAST", "beast_mcc.tree", package="treeio")
beast <- read.beast(file)
ggtree(beast, aes(color=rate)) +
geom_range(range='length_0.95_HPD', color='red', alpha=.6, size=2) +
geom_nodelab(aes(x=branch, label=round(posterior, 2)), vjust=-.5, size=3) +
scale_color_continuous(low="darkgreen", high="red") +
theme(legend.position=c(.1, .8))
The code plots a tree with ranges on nodes and tips. It is clear to me that the data for plotting the ranges is stored in beast@data. However, I would like to remove some segments on the plot (e.g. tip ranges), It seemed straightforward to me that I could just apply a filter on this tibble and then plot this again. E.g.
beast@data <- beast@data %>% filter(node != "1") # to remove segment on node 1
When I then run:
ggtree(beast, aes(color=rate)) +
geom_range(range='length_0.95_HPD', color='red', alpha=.6, size=2) +
geom_nodelab(aes(x=branch, label=round(posterior, 2)), vjust=-.5, size=3) +
scale_color_continuous(low="darkgreen", high="red") +
theme(legend.position=c(.1, .8))
I get the error:
Error in is.finite(x) : default method not implemented for type 'list'
I have two questions:
1) Why can I not manipulate the beast@data tibble without producing an error? Did I miss some dependencies?
2) How can I in the example above only plot the ranges on nodes, but not at the tips?
Any help would be highly appreciated.
Many Thanks,
Marco