Question: Problem with font size in a tree
gravatar for luzglongoria
17 months ago by
luzglongoria40 wrote:


I am trying to make an interaction between two phylogenetic trees. I am able to run all the code (no errors) the problem is that the size of the letter of one of the trees is too big enter image description here

I have been able to change the size by plotting the plot and asking R to minimize the size but the problem is that I want to use the tree for an interaction with another tree. Please, see below:

# Packages

 #Import trees
bTreeH = read.newick(file="Huanuco_bird_tree.newick")
pTreeH ="Huanuco_parasite_tree.nex")

# Prepare parasite Tree
  pTreeH = force.ultrametric(pTreeH)

# Create two fata frames

df.bird.H = data.frame(name = c("Amazilia_chionogaster",

  df.parasite.H = data.frame(Name = c("P_SGS1",

# Creation of the association matrix:
  associationH <- cbind(df.bird.H, df.parasite.H)

# Create a vector for colors
  cols.H <- c('2','1','2','2','1','2','1','1','1','1','2','1')

# Create a vector for chose colors
  cols.1.H <- c("#e7298a","grey","#e7298a","#e7298a","grey","#e7298a","grey","grey","grey","grey","#e7298a","grey")  #1

# Create the two trees face to face
  Interaction_Huanuco <- cophyloplot(bTreeH, pTreeH, assoc=associationH,
                   length.line = 4, space = 100, gap = 3, col = cols.1.H)

There is no error message but the bTreeH (the one with more names) is imposible to read properly because of the size of the letters. Some months ago I was able to run these analyses with any trouble, the size of the letters seemed to adjust itself but now... I am running exactly the same code and I have this problem.

Any help is more than welcome.

ADD COMMENTlink modified 14 months ago by tiffany.chin20 • written 17 months ago by luzglongoria40
gravatar for tiffany.chin
14 months ago by
tiffany.chin20 wrote:

I had the same problem; see:

I wasn't able to copy the internal function as mentioned in the above link, but I found a work around.

You'll have to edit the internal function plotCophylo2 to change the text size with cex: (where the function refers to text, cex = 1; change to cex = 0.5).

In my case, I just called the internal function a different name, changed the code for text size, and then fix(cophyloplot) to recall the new internal function. After that, it ran smoothly.

Hope that helps.

ADD COMMENTlink written 14 months ago by tiffany.chin20
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2172 users visited in the last hour