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

ggjoy facet with ggtree

Is it possible to add a joyplot as a panel to a plot that includes a ggtree, as shown in these examples? Examples of joyplots are here. I realize that I could manually put the species labels for the joyplot in the same order as the tree tip labels,…
LCM
  • 292
  • 4
  • 14
4
votes
1 answer

how to apply both italic and normal fonts in the same label in phylogenetic tree in ggtree

I want A in italic, and CBS in normal. I think ggtext might be useful, but I got an error. here is an example: tree<-read.tree(text="(A,(B,C));") labs=c("*A*CBS","B","C") tree$tip.label<-labs ggtree(tree)+ geom_tiplab(align=T) +…
Cai Bian
  • 141
  • 1
  • 6
4
votes
1 answer

R ggtree: How to label single tree tip with ggtree similar to labeling nodes with geom_cladelabel

I'm having trouble with labeling single tips in my tree with ggtree. I'm trying to highlight and label nodes from a tree with geom_hilight and geom_cladelabel. This seems to work fine with nodes that have more than 1 tree tip, but when I try to…
Kak Schoen
  • 364
  • 2
  • 18
3
votes
0 answers

Error in gheatmap (ggtree package): “Error: Must request at least one colour from a hue palette.”

The last line gives an error: library(ggtree) nwk <- read.tree("nwk_file") metadata <- read.table("metadata_file", sep="\t", stringsAsFactor=FALSE) g <- ggtree(nwk) gheatmap(g, metadata, offset=5, width=0.5, font.size=3, colnames_angle=-45, …
orenriv
  • 31
  • 2
3
votes
4 answers

ggtree plotting area not big enough

I am trying to plot a circular phylogenetic tree with bootstrap labeled nodes and user defined/colored tip labels. I got the bootstrap results and labels to work properly, but somehow I just couldn't fully draw the plot in my graphic device. There…
user2927760
  • 99
  • 2
  • 8
2
votes
1 answer

Remove the 'a' from ggtree figure

Given a tree with tip labels colored by a group eg: library(ggplot2) library(ggtree) nwk <- system.file("extdata", "sample.nwk", package="treeio") tree <- read.tree(nwk) meta = data.frame(label = c("A", "B", "C", "D", "E", "F", "G", "H", "I",…
Amar
  • 1,340
  • 1
  • 8
  • 20
2
votes
0 answers

phylogeography: how to combine phylogenetic tree and geographic map, and create segments between tips and sampling localities with gg* packages?

I am trying to do something similar to what is described in the blog here but using R with ggtree, ggmap, and ggplot2. I want to be able to combine the plots of the phylogenetic tree and the map showing the sampling locations of the tips on a…
Eve
  • 21
  • 1
2
votes
1 answer

unable to install ggtree in R version 4.0.5

I tried to install ggtree by using command >BiocManager::install("ggtree") but in the end in am getting error >Installation paths not writeable, unable to update packages path: C:/Program Files/R/R-4.0.5/library packages: boot, class, cluster,…
Nido
  • 55
  • 1
  • 1
  • 10
2
votes
6 answers

ggtree 2.4.2 error: Error in DataMask$new(.data, caller_env) : argument "caller_env" is missing, with no default

I am trying to plot an ancestral states tree generated in RevBayes using RevGadgets 1.0.0 and ggtree 2.4.2. The call is the following, and all of the variables check out, including the tree file, in Nexus format, which I can open in FigTree…
Peter B
  • 71
  • 4
2
votes
1 answer

Suppress one x-axis, keep the other with ggtree and geom_facet

I'm trying to remove the x-axis from one plot (the tree on the left should have no x-axis labels, ticks, line, etc.), while keeping the x-axis on the plot on the right (0-60, ticks, label: "Number of G's"). I've unsuccessfully searched through…
SP1
  • 51
  • 6
2
votes
1 answer

Circular tree with heatmap

This question is quite trivial but I cannot be handled nicely with. I'm trying to plot a circular tree with a side heatmap. I'm using ggtree but any approach ggplo2 based is welcome. The problems that I'm not understanding well the gheatmap…
Aureliano Guedes
  • 767
  • 6
  • 22
2
votes
1 answer

Unable to plot hclust object with ggtree

I am trying to plot a dendrogram from a hclust object with ggtree but I keep getting the same error message: Error: `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class hclust I have been extensively…
Markel
  • 93
  • 1
  • 7
2
votes
1 answer

How to colour the branches of an unrooted tree using a variable in R

I would like to generated unrooted neighbour joining trees from input haplotype data, and then colour the branches of the trees based on a variable. I am using the packages Ape and ggtree. The haplotypes and co-variables (metadata) are on two…
Will Hamilton
  • 357
  • 2
  • 17
2
votes
1 answer

Coloring lines in tanglegram based on position of nodes

I am creating tanglegrams with the following code: library(ggtree) library(ape) tree1 <- read.tree(text='(((A:4.2,B:4.2):3.1,C:7.3):6.3,D:13.6);') tree2 <- read.tree(text='(((B:4.2,A:4.2):3.1,C:7.3):6.3,D:13.6);') p1 <- ggtree(tree1) p2 <-…
Haakonkas
  • 961
  • 9
  • 26
2
votes
1 answer

How do I add a legend to a facet in ggtree's `facet_plot`?

I am using facet_plot() to add a barplot with trait values next to the tips of my tree. I need there to be a legend for the barplot, but could not find in the documentation or in a similar question how to do that. It seems that facet_plot() makes…
mpe
  • 1,000
  • 1
  • 8
  • 25
1
2 3 4 5 6 7