Questions tagged [ggtree]

For questions about ggtree, the R package for visualization and annotation of phylogenetic trees.

ggtree is a R package dealing with phylogenetic data object and created in order to facilitate and enhance the representation of phylogeny tree using ggplot

source and guide: https://guangchuangyu.github.io/ggtree-book/chapter-ggtree.html

103 questions
1
vote
0 answers

how to color the phylogenic dendrogram labels based on species traits with ggtree?

I made a phylogeny dendrogram with Vphylomaker and plotted with ggtree. Here is a data example. species <- c("Physaliastrum japonicum", "Azolla imbricata", "Ligularia sibirica","Silene repens var. apoiensis", "Eriocaulon amanoanum") genus <-…
marie
  • 315
  • 1
  • 9
1
vote
1 answer

R ggtree annotate node in accordance with branch length

I have a phylogenetic tree made by a Newick file. library(tidyverse) library(ggtree) tree <- read.tree("newick_test.nwk") p1 <- ggtree(tree) + geom_tree() + theme_tree2() + coord_cartesian(xlim = c(0,40), ylim = c(0,19)) and the Newick file…
SG Kwon
  • 163
  • 1
  • 9
1
vote
1 answer

Plotting a tree - collapsing a vector of nodes

I am trying to plot a large tree using ggtree, but, due to its size, I would like to collapse multiple nodes. I am following a tutorial , but it collapses the nodes one at the time, and this is not an option in my case. Here is my…
Max_IT
  • 602
  • 5
  • 15
1
vote
1 answer

Remove space between gheatmap tiles

I'm creating a tree with a ggtree and gheatmap. I am trying to work out how to remove the space between the tip tiles and/or merge adjacent tiles with the same value. Below is the code I used: library(ape) library(tidyverse) library(ggtree) tree <-…
Tom Weeks
  • 13
  • 3
1
vote
0 answers

Add annotation to ggtree in R

My goal is to draw a tree and add some annotation in a table next to the tree. I'd like to add both colors and text (the given data is in a dataframe). I was able to draw the tree and the labels, but can't work out how to add the table. Is there a…
bmv
  • 184
  • 2
  • 10
1
vote
2 answers

How can I plot colored tip labels in ggtree without including it as part of the legend?

I have been trying to plot a tree with color-coded branches and tips using the ggtree package in R. Here is an example code using a tree of Anolis…
user2352714
  • 314
  • 1
  • 15
1
vote
1 answer

How can I get ggtree::geom_range to work?

I am trying to add range bars to nodes as described in the treedata book. Here is an example from the book of what I am trying to achieve: Note the red bars. Here is code that should create a tree image with red…
winni2k
  • 1,460
  • 16
  • 19
1
vote
1 answer

How can I add pie charts to the tip of a ggplot phylogenetic tree?

I'm trying to make a phylogenetic tree with pie charts at the tips of the tree, but I'm really stuck with how to do it. Here's a simple fabricated example library("treeio") library("ggtree") nwk <- system.file("extdata", "sample.nwk",…
Phylo
  • 46
  • 2
1
vote
0 answers

How can I combine a ggtree and a histogram?

I want to combine the ggtree generated p and the histogram based on dat. Both the phylogenetic tree and histogram have same entries, but the only thing I observe is the phylogenetic tree without any text or histogram. I don't understand why the tree…
srevar
  • 11
  • 2
1
vote
1 answer

How to colour the tips of tree by group in ggtree?

How do I simply colour the tips of my tree according to the group the sample belongs to? nwk <- system.file("extdata", "sample.nwk", package="treeio") tree <- read.tree(nwk) group_1 <- rep("1.1.1", 5) group_2 <- rep("1.1.2", 3) group_3 <-…
Luther_Blissett
  • 327
  • 1
  • 6
  • 16
1
vote
1 answer

gheatmap function (ggtree package) returns "Error: Must request at least one colour from a hue palette." when plotting the gheatmap object

I'm trying to add a heat map onto a phylogenic tree using the ggtree function gheatmap. Despite no apparent errors appearing in the lines that create the gheatmap object, when trying to plot the object, it returns "Error: Must request at least one…
TheOddLeaf
  • 11
  • 3
1
vote
1 answer

How to link a couple of tip nodes in an inverted circular phylogenetic tree using ggtree in R

I want to create a figure of an annotated phylogenetic tree in circular layout with ggtree in R. Some tip nodes must be linked by a curve line. I can achieve this with the geom_taxalink() function in the rectangular layout, but it doesn't work in…
1
vote
1 answer

ggtree highlight clades behind

I am working on a phylogenetic tree with R package ggtree and want to highlight nodes. My tree is stored in p, and the node I want to highlight is in G10. p <- ggtree(tree, right=T, layout="circular") G10 <- findMRCA(tree,…
Hkam
  • 11
  • 2
1
vote
2 answers

add another layer to ggplot2/ggtree based on user input Rshiny

The example below is using ggtree in which I can brush the tips in the phylogeny and add an annotation label ("clade"). Steps to get the app going - load the tree - called vert.tree brush over (highlight) tips (test with human and lemur) and press…
1
vote
1 answer

How can I increase the maximum branch width in ggtree?

I added some traits to the branches of my phylogram and scaled the branch widths to their value: library(ggtree) library(tidyverse) tree <- rtree(3, rooted = T) trait <- data.frame(node = 1:(length(tree$edge.length)+1), thing =…
mpe
  • 1,000
  • 1
  • 8
  • 25