<p>I suspect the solution is to realign the two plots within "ggarrange", available <a href="https://www.rdocumentation.org/packages/ggpubr/versions/0.2/topics/ggarrange" rel="nofollow noreferrer">here</a></p>

<p>The problem is stacking ggtree with geom_tiplab. The ggarrange library is described on STHDA <a href="http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/81-ggplot2-easy-way-to-mix-multiple-graphs-on-the-same-page/" rel="nofollow noreferrer">here</a>  </p>

<p>I have not used this library however, but it should be easy because you are working singly within R. I tend to use ggplot2 within Python via rpy2, which is much more difficult and restricted. </p>

CC BY-SA 4.0
2019-06-16T17:21:32.333Z
2019-06-18T15:00:47.333Z
2019-06-18T15:00:47.333Z
M__
<p>You were very close, you just need to supply the <code>offset</code> argument to <code>msaplot()</code>.</p>

<p>So using your code block above with one extra argument in <code>msaplot()</code></p>

<pre><code>library(tidyverse)
library(ggtree) 
library(seqinr)
tree = read.tree("din.newick") 
msaplot(p=ggtree(tree), fasta = "din.fasta")
msaplot(p=ggtree(tree) + geom_tiplab(align=TRUE), fasta = "din.fasta", offset = 5)
</code></pre>

<p>yields</p>

<p><a href="https://i.sstatic.net/3thEk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/3thEk.png" alt="msaplot with offset"></a></p>

<p>Thank you for supplying a minimal and reproducible example!</p>

CC BY-SA 4.0
2019-06-18T04:45:34.043Z
Thank you @Kohl Kinning.
Kumar
CC BY-SA 4.0
2019-06-17T16:14:55.147Z
2019-06-17T16:14:55.147Z
Kohl Kinning
<p>I would like to visualize tree with multiple sequence alignment. 
My <code>din.newick</code> file is shown below,</p>

<pre><code>(org1:0.49999997,org2:0.47298786,org3:28.37858179);
</code></pre>

<p>My <code>din.fasta</code> alignment file shown below,</p>

<pre><code>&gt;org1
ATGCTA
&gt;org2
TAGCAT
&gt;org3
AGTAGT
</code></pre>

<p>I have tried the following code,</p>

<pre><code>library(tidyverse)
library(ggtree) 
library(seqinr)
tree = read.tree("din.newick") 
msaplot(p=ggtree(tree), fasta = "din.fasta")
msaplot(p=ggtree(tree) + geom_tiplab(align=TRUE), fasta = "din.fasta")
</code></pre>

<p>The above mentioned code is generating tree with the alignment matrix, but the tree root tip labels are not visible. It is either overlapped with matrix or it is not at all visible. <a href="https://i.sstatic.net/y9LbQ.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/y9LbQ.jpg" alt="msaplot(p=ggtree(tree) + geom_tiplab(align=TRUE), fasta = &quot;din.fasta&quot;)"></a> Kindly help me to fix this issue. </p>

<r><bioconductor><fasta><phylogenetics><phylogeny>
Issue with visualising cladogram/phylogenetic tree with multiple sequence alignment data in R?
# Issue with visualising cladogram/phylogenetic tree with multiple sequence alignment data in R?

(Asked by: username_0 on 2019-06-16)

I would like to visualize tree with multiple sequence alignment. 
My din.newick file is shown below,
(org1:0.49999997,org2:0.47298786,org3:28.37858179);

My din.fasta alignment file shown below,
>org1
ATGCTA
>org2
TAGCAT
>org3
AGTAGT

I have tried the following code,
library(tidyverse)
library(ggtree) 
library(seqinr)
tree = read.tree("din.newick") 
msaplot(p=ggtree(tree), fasta = "din.fasta")
msaplot(p=ggtree(tree) + geom_tiplab(align=TRUE), fasta = "din.fasta")

The above mentioned code is generating tree with the alignment matrix, but the tree root tip labels are not visible. It is either overlapped with matrix or it is not at all visible.  Kindly help me to fix this issue.

**Tags:** r, bioconductor, fasta, phylogenetics, phylogeny

---

## 2 answers

### Answer by username_2 on 2019-06-17. Score: 4 | Accepted answer

You were very close, you just need to supply the offset argument to msaplot().
So using your code block above with one extra argument in msaplot()
library(tidyverse)
library(ggtree) 
library(seqinr)
tree = read.tree("din.newick") 
msaplot(p=ggtree(tree), fasta = "din.fasta")
msaplot(p=ggtree(tree) + geom_tiplab(align=TRUE), fasta = "din.fasta", offset = 5)

yields

Thank you for supplying a minimal and reproducible example!

> **Comments:**
> **username_0**: Thank you @Kohl Kinning.  

---

### Answer by username_1 on 2019-06-16. Score: 0

I suspect the solution is to realign the two plots within "ggarrange", available [here](https://www.rdocumentation.org/packages/ggpubr/versions/0.2/topics/ggarrange)

The problem is stacking ggtree with geom\_tiplab. The ggarrange library is described on STHDA [here](http://www.sthda.com/english/articles/24-ggpubr-publication-ready-plots/81-ggplot2-easy-way-to-mix-multiple-graphs-on-the-same-page/)

I have not used this library however, but it should be easy because you are working singly within R. I tend to use ggplot2 within Python via rpy2, which is much more difficult and restricted.


---

