title: Plot phylogenetic trees face to face with links in R
body: <p>I would like to plot two phylogenies opposite each other in R using the <code>ape</code> package. One tree has 40 nodes and one has 26 nodes:</p>
  
  <pre><code>library(ape)
  tree1 &lt;- rtree(40)
  tree2 &lt;- rtree(26)
  </code></pre>
  
  <p>The <code>cophyloplot</code> function plots these face to face with specified links.</p>
  
  <p>I'm having trouble specifying the links.</p>
  
  <p>Note that in my actual <code>nexus</code> tree files, tip labels are text (and I'm unsure how to change these to numbers, if necessary...).</p>
  
  <p>The links should be as follows:</p>
  
  <p>If, in the <code>tree1</code> nexus file, the tip labels of the sequences are 1-40. In the <code>tree2</code> nexus file, tip labels are 1-26. Then links should be:</p>
  
  <pre><code>a &lt;- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
  b &lt;- c(14,1,4,1,9,12,2,10,6,3,13,5,14,15,18,19,19,7,14,9,10,11,25,22,21,16,23,24,26,17,1,12,12,21,15,16,21,8,20,21) 
  association &lt;- cbind(a, b)
  </code></pre>
  
  <p>(i.e. sequence 1 in <code>tree1</code> is linked with sequence 14 in <code>tree2</code>)</p>
  
  <p>So, I use something like this to plot the trees:</p>
  
  <pre><code>cophyloplot(tree1, tree2, assoc=association,length.line=4, space=28, gap=10, rotate=TRUE)
  </code></pre>
  
  <p>And calculate the distance matrix:</p>
  
  <pre><code>dist.topo(tree1, tree2, method = "PH85")
  </code></pre>
  
  <p>I'm not quite sure where I'm going wrong here. Any help would be appreciated! </p>