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
1 answer

How to color the tip labels on a phylogenetic tree based on factors in external CSV file?

I'm running a MacOS Mojave with R Studio Version 1.2.1335. I am trying to change the colors of the tip labels on a phylogenetic tree that I uploaded to R via a nexus file. I have a separate CSV file with all of the species names in the exact format…
olivegr
  • 21
  • 3
1
vote
0 answers

How do I both annotate the nodes of a tree and color certain branches with ggtree?

I want to annotate a phylogenetic tree with bootstrap scores and add color to certain clades in ggtree. Something goes wrong when I try to do both, which has something to do with the indices of the internal nodes. Here is a random tree with 24…
Namenlos
  • 475
  • 5
  • 17
1
vote
0 answers

How to plot discrete characters on phylogenetic tree using phytools?

I am looking to plot type of mating system (monogamous, polygynous and promiscuous) onto a phylogenetic tree built using caper package, ggtree() and a super tree in nexus file format. I have tried to follow this tutorial on the phytools website,…
Nik
  • 39
  • 1
  • 7
1
vote
1 answer

How to shorten/truncate a branch in ggtree

With a phylo tree generated with the R packages APE and plotting with ggtree - is anyone aware of a method to make branches shorter? My angle is that I'm comparing mostly intra-species, but added the two most closely related species, partly to root…
Mgall
  • 37
  • 1
  • 7
1
vote
1 answer

Can geom_text in gg_tree be coded to not stagger the distance from the nodes?

I have aligned some amino acid sequences in R and imported the distance matrix (dist_mat) for use in ggtree using tree <- ape::nj(dist_mat). It looks something like this: node parent branch.length x y label isTip branch…
reubenmcg
  • 371
  • 4
  • 18
0
votes
1 answer

ggplot2 cannot find function "ggtitle"

I'm using ggtree, which uses ggplot2, to plot a phylogeny. I'm using R version 4.3.1, with ggplot version 3.4.2, and ggtree 3.8.2. the script (executed from a temp file) that gives the issue is very simple: library(ggtree) tree <-…
con
  • 5,767
  • 8
  • 33
  • 62
0
votes
1 answer

Color node points in ggtree: Must request at least one colour from a hue palette

I would like to color the nodes in a tree according to a categorical variable with the help of ggtree. However, I am receiving the error "Must request at least one colour from a hue palette." I have constructed an example with the example tree from…
0
votes
0 answers

geom_tippoint: How to incorporate the palette I want for the color parameter in ggtree's geom_tippoint for the tippoints?

I have 2 trees with unequal number of nodes and I want put them together with their tippoints colored according to their taxa. But I am unable to have the same color palette for both the trees, I essentially am looking for a shared legend for the…
0
votes
0 answers

Specify colors of ggtree labels

I would like to add different colors to my tree labels. Therefore, I thought of combining the tree with a metadata-frame and it seems to work well. The only problem is that I don't get how to specifiy the colors. Currently, they are randomly chosen.…
0
votes
0 answers

ggtree. Error in `geom_segment2()` when trying to put lines conectig tips to names

I'm trying to represent a phylogenetic tree with the following code. ggtree(tree2, layout="circular", size=0.03)+ geom_tiplab2(aes(label=), align=T, size=0.5, hjust=0.1) but I get the following error: Error in `geom_segment2()`: ! Problem while…
fuseros
  • 17
  • 5
0
votes
0 answers

Adding slices to the tips of a phylogeny using ggtree or ape

I am trying to plot thin slices at the bottom of my phylogeny to visualize the distribution of a particular trait. Similar to this plot: But I can't figure out how to do it in either ape or ggtree frameworks. Here is some code that shows how far I…
SamPassmore
  • 1,221
  • 1
  • 12
  • 32
0
votes
0 answers

How to plot different ggtrees constructed from the same data at the same size?

I am trying to plot different phylogenetic trees from the same data using ggtree and ggplot2. However, the size of these individual trees is different, despite being constructed from the same tree data. As I cannot share my research data, I am…
0
votes
1 answer

How to create a circos plot

I've 50 COVID samples (PE fastq reads) along with clades and lineage data for each sample. I am doing a phylogenetic analysis.My workflow to produce the tree is as following: raw reads (.fastq) --> assembly (SPades) --> RagTag (scaffolding) -->…
0
votes
0 answers

circular cladogram showing relative abundance and annotated by factor using phyloseq input

I would like to make a circular cladogram but only showing the changes in relative abundances between factors, as I don't have the phylogenetic tree my phyloseq object only contains otu table, and taxonomy table. I would like to get something like…
i.b
  • 167
  • 11
0
votes
0 answers

How to get the coordinate of the nodes of a circular tree by ggtree

I want to know how to get the node coordinates of the deformed ggtree. The coordinates obtained by ggtree::fortify() are valid in a square tree, but I don't know how to get coordinates for other tree points with shapes such as circular or slanted. I…
Yueer
  • 1