<!DOCTYPE html>
  
  
  
  
   <html class="no-js"> 

  <head lang="en-us">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=10" />
    <title>ggtree</title>
    <meta name="generator" content="Hugo 0.24.1" />

    
    <meta name="description" content="Visualization and annotation of phylogenetic trees.">
    
    <link rel="canonical" href="https://guangchuangyu.github.io/ggtree/">
    
    <meta name="author" content="Guangchuang Yu">
    

    <meta property="og:url" content="https://guangchuangyu.github.io/ggtree/">
    <meta property="og:title" content="ggtree">
    <meta property="og:image" content="https://guangchuangyu.github.io/ggtree/images/gc.png">
    <meta name="apple-mobile-web-app-title" content="ggtree">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">

    <link rel="shortcut icon" type="image/x-icon" href="https://guangchuangyu.github.io/ggtree/images/favicon.ico">
    <link rel="icon" type="image/x-icon" href="https://guangchuangyu.github.io/ggtree/images/favicon.ico">

    <style>
      @font-face {
        font-family: 'Icon';
        src: url('https://guangchuangyu.github.io/ggtree/fonts/icon.eot');
        src: url('https://guangchuangyu.github.io/ggtree/fonts/icon.eot')
               format('embedded-opentype'),
             url('https://guangchuangyu.github.io/ggtree/fonts/icon.woff')
               format('woff'),
             url('https://guangchuangyu.github.io/ggtree/fonts/icon.ttf')
               format('truetype'),
             url('https://guangchuangyu.github.io/ggtree/fonts/icon.svg')
               format('svg');
        font-weight: normal;
        font-style: normal;
      }
    </style>

    <link rel="stylesheet" href="https://guangchuangyu.github.io/ggtree/stylesheets/application.css">
    <link rel="stylesheet" href="https://guangchuangyu.github.io/ggtree/stylesheets/temporary.css">
    <link rel="stylesheet" href="https://guangchuangyu.github.io/ggtree/stylesheets/palettes.css">
    <link rel="stylesheet" href="https://guangchuangyu.github.io/ggtree/stylesheets/highlight/highlight.css">

    
    
    
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Ubuntu:400,700|Ubuntu&#43;Mono">
    <style>
      body, input {
        font-family: 'Ubuntu', Helvetica, Arial, sans-serif;
      }
      pre, code {
        font-family: 'Ubuntu Mono', 'Courier New', 'Courier', monospace;
      }
    </style>

    
    <script src="https://guangchuangyu.github.io/ggtree/javascripts/modernizr.js"></script>

    
    <link href="https://guangchuangyu.github.io/ggtree/index.xml" rel="alternate" type="application/rss+xml" title="ggtree" />
    <link href="https://guangchuangyu.github.io/ggtree/index.xml" rel="feed" type="application/rss+xml" title="ggtree" />
    

  </head>
  <body class="palette-primary-teal palette-accent-teal">



	
	


<div class="backdrop">
	<div class="backdrop-paper"></div>
</div>

<input class="toggle" type="checkbox" id="toggle-drawer">
<input class="toggle" type="checkbox" id="toggle-search">
<label class="toggle-button overlay" for="toggle-drawer"></label>

<header class="header">
	<nav aria-label="Header">
  <div class="bar default">
    <div class="button button-menu" role="button" aria-label="Menu">
      <label class="toggle-button icon icon-menu" for="toggle-drawer">
        <span></span>
      </label>
    </div>
    <div class="stretch">
      <div class="title">
        ggtree
      </div>
    </div>

    
    <div class="button button-twitter" role="button" aria-label="Twitter">
       <a href="https://twitter.com/guangchuangyu" title="@guangchuangyu on Twitter" target="_blank" class="toggle-button icon icon-twitter"></a>
    </div>
    

    
    <div class="button button-github" role="button" aria-label="GitHub">
      <a href="https://github.com/GuangchuangYu" title="@GuangchuangYu on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
    </div>
    
    
        
  </div>
  <div class="bar search">
    <div class="button button-close" role="button" aria-label="Close">
      <label class="toggle-button icon icon-back" for="toggle-search"></label>
    </div>
    <div class="stretch">
      <div class="field">
        <input class="query" type="text" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck>
      </div>
    </div>
    <div class="button button-reset" role="button" aria-label="Search">
      <button class="toggle-button icon icon-close" id="reset-search"></button>
    </div>
  </div>
</nav>
</header>

<main class="main">
	<div class="drawer">
		<nav aria-label="Navigation">
  <a href="https://github.com/GuangchuangYu/ggtree" class="project">
    <div class="banner">
      
        <div class="logo">
          <img src="https://guangchuangyu.github.io/ggtree/images/gc.png">
        </div>
      
      <div class="name">
        <strong>ggtree </strong>
        
          <br>
          GuangchuangYu/ggtree
        
      </div>
    </div>
  </a>

  <div class="scrollable">
    <div class="wrapper">
      
        <ul class="repo">
          <li class="repo-download">
            <a href="https://github.com/GuangchuangYu/ggtree/archive/master.zip" target="_blank" title="Download" data-action="download">
              <i class="icon icon-download"></i> Download
            </a>
          </li>
          <li class="repo-stars">
            <a href="https://github.com/GuangchuangYu/ggtree/stargazers" target="_blank" title="Stargazers" data-action="star">
              <i class="icon icon-star"></i> Stars
              <span class="count">&ndash;</span>
            </a>
          </li>
        </ul>
        <hr>
      

      <div class="toc">
        
        <ul>
          




<li>
  
    



<a  title="ggtree" href="./">
	
	ggtree
</a>



  
</li>



<li>
  
    



<a  title="Documentation" href="./documentation/">
	
	Documentation
</a>



  
</li>



<li>
  
    



<a  title="FAQ" href="./faq/">
	
	FAQ
</a>



  
</li>



<li>
  
    



<a  title="Featured Articles" href="./featured-articles/">
	
	Featured Articles
</a>



  
</li>



<li>
  
    



<a  title="Gallery" href="./gallery/">
	
	Gallery
</a>



  
</li>



<li>
  
    



<a  title="Tweets" href="./tweets/">
	
	Tweets
</a>



  
</li>


        </ul>
        

        
        <hr>
        <span class="section">The author</span>

        <ul>
          
          <li>
            <a href="https://twitter.com/guangchuangyu" target="_blank" title="@guangchuangyu on Twitter">
              @guangchuangyu on Twitter
            </a>
          </li>
          

          
          <li>
            <a href="https://github.com/GuangchuangYu" target="_blank" title="@GuangchuangYu on GitHub">
              @GuangchuangYu on GitHub
            </a>
          </li>
          

          
          <li>
            <a href="https://guangchuangyu.github.io/blog_images/biobabble.jpg" title="关注公众号: biobabble">
              @biobabble on WeChat
            </a>
          </li>
          

          
          <li>
            <a href="mailto:guangchuangyu@gmail.com" title="Email of guangchuangyu@gmail.com">
              Contact via email
            </a>
          </li>
          
        </ul>
        
        <center><span class="zaln"><a href="https://mp.weixin.qq.com/s?__biz=MzI5NjUyNzkxMg==&mid=2247484170&idx=1&sn=ce5f7eb6df66d79661276a64bf25b4bc&chksm=ec43b24ddb343b5b2877574153aeccd049a6824716063883edb35c2338bd32c067caf3885f53#rd" class="zb">赞赏</a></span></center>
<div style="width:250px;margin:auto;"><script type="text/javascript" src="//rf.revolvermaps.com/0/0/7.js?i=5qpvv5zz7fp&amp;m=0&amp;c=ff0000&amp;cr1=ffffff&amp;sx=0" async="async"></script></div>
      </div>
    </div>
  </div>
</nav>

	</div>

	<article class="article">
		<div class="wrapper">
			
				<h1>ggtree: visualization and annotation of phylogenetic trees </h1>

				<p><link rel="stylesheet" href="https://guangchuangyu.github.io/css/font-awesome.min.css"> <link rel="stylesheet" href="https://guangchuangyu.github.io/css/academicons.min.css"></p>
<p><img src="https://raw.githubusercontent.com/Bioconductor/BiocStickers/master/ggtree/ggtree.png" height="200" align="right" /></p>
<p><a href="https://bioconductor.org/packages/ggtree"><img src="https://img.shields.io/badge/release%20version-1.8.2-blue.svg?style=flat" alt="releaseVersion" /></a> <a href="https://github.com/guangchuangyu/ggtree"><img src="https://img.shields.io/badge/devel%20version-1.9.4-blue.svg?style=flat" alt="develVersion" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-19498/total-blue.svg?style=flat" alt="total" /></a> <a href="https://bioconductor.org/packages/stats/bioc/ggtree"><img src="https://img.shields.io/badge/downloads-941/month-blue.svg?style=flat" alt="month" /></a></p>
<p>The <code>ggtree</code> package extending the <em>ggplot2</em> package. It based on grammar of graphics and takes all the good parts of <em>ggplot2</em>. <em>ggtree</em> is designed for not only viewing phylogenetic tree but also displaying annotation data on the tree. <em>ggtree</em> is released within the <a href="https://bioconductor.org/packages/ggtree/">Bioconductor</a> project and the source code is hosted on <a href="https://github.com/GuangchuangYu/ggtree"><i class="fa fa-github fa-lg"></i> GitHub</a>.</p>
<div id="authors" class="section level2">
<h2><i class="fa fa-user"></i> Authors</h2>
<p>Guangchuang Yu and Tommy Tsan-Yuk Lam, School of Public Health, The University of Hong Kong.</p>
</div>
<div id="citation" class="section level2">
<h2><i class="fa fa-book"></i> Citation</h2>
<p>Please cite the following article when using <code>ggtree</code>:</p>
<p><a href="http://dx.doi.org/10.1111/2041-210X.12628"><img src="https://img.shields.io/badge/doi-10.1111/2041--210X.12628-blue.svg?style=flat" alt="doi" /></a> <a href="https://www.altmetric.com/details/10533079"><img src="https://img.shields.io/badge/Altmetric-342-blue.svg?style=flat" alt="Altmetric" /></a> <a href="https://scholar.google.com.hk/scholar?oi=bibs&amp;hl=en&amp;cites=7268358477862164627"><img src="https://img.shields.io/badge/cited%20by-40-blue.svg?style=flat" alt="citation" /></a></p>
<p><strong>G Yu</strong>, DK Smith, H Zhu, Y Guan, TTY Lam<sup>*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. <strong><em>Methods in Ecology and Evolution</em></strong>. 2017, 8(1):28-36.</p>
</div>
<div id="featured-articles" class="section level2">
<h2><i class="fa fa-pencil"></i> Featured Articles</h2>
<div class="figure">
<img src="https://guangchuangyu.github.io/featured_img/ggtree/2015_peiyu_1-s2.0-S1567134815300721-gr1.jpg" />

</div>
<p><i class="fa fa-hand-o-right"></i> Find out more on <i class="fa fa-pencil"></i> <a href="https://guangchuangyu.github.io/ggtree/featuredArticles/">Featured Articles</a>.</p>
</div>
<div id="installation" class="section level2">
<h2><i class="fa fa-download"></i> Installation</h2>
<p>Install <code>ggtree</code> is easy, follow the guide on the <a href="https://bioconductor.org/packages/ggtree/">Bioconductor page</a>:</p>
<pre class="r"><code>## try http:// if https:// URLs are not supported
source(&quot;https://bioconductor.org/biocLite.R&quot;)
## biocLite(&quot;BiocUpgrade&quot;) ## you may need this
biocLite(&quot;ggtree&quot;)</code></pre>
<p>If you have problems when installing some of the dependent packages, please refer to the <a href="https://github.com/GuangchuangYu/ggtree/wiki/ggtree-installation">ggtree-installation</a> wiki page.</p>
</div>
<div id="overview" class="section level2">
<h2><i class="fa fa-cogs"></i> Overview</h2>
<div id="getting-tree-into-r" class="section level4">
<h4><i class="fa fa-angle-double-right"></i> Getting tree into R</h4>
<ul>
<li>tree parsers: bring evolution evidences to be used/analyzed in <code>R</code></li>
<li><code>merge_tree</code>: allows evolution evidences to be merged and compared</li>
<li><code>fortify</code> methods: convert tree objects into tidy data frame</li>
</ul>
</div>
<div id="tree-visualization-annotation" class="section level4">
<h4><i class="fa fa-angle-double-right"></i> Tree visualization &amp; annotation</h4>
<ul>
<li>parsing tree as a collection of nodes allows grammar of graphics to be supported</li>
<li><code>geom_tree</code>: extends <code>ggplot2</code> to support tree structure</li>
<li>several layers and functions for tree annotation</li>
<li>supports annotating phylogenetic trees with user’s own data</li>
</ul>
</div>
<div id="tree-manipulation" class="section level4">
<h4><i class="fa fa-angle-double-right"></i> Tree manipulation</h4>
<ul>
<li>helper functions for tree manipulation, make it possible to explore the tree visually</li>
</ul>
<p><i class="fa fa-hand-o-right"></i> Find out details and examples on <i class="fa fa-book"></i> <a href="https://guangchuangyu.github.io/ggtree/documentation/">Documentation</a>.</p>
</div>
</div>
<div id="projects-that-depend-on-ggtree" class="section level2">
<h2><i class="fa fa-code-fork"></i> Projects that depend on <em>ggtree</em></h2>
<div id="cran-packages" class="section level4">
<h4><i class="fa fa-angle-double-right"></i> CRAN packages</h4>
<ul>
<li><a href="https://cran.r-project.org/package=harrietr">harrietr</a>: Wrangle Phylogenetic Distance Matrices and Other Utilities</li>
</ul>
</div>
<div id="bioconductor-packages" class="section level4">
<h4><i class="fa fa-angle-double-right"></i> Bioconductor packages</h4>
<ul>
<li><a href="https://www.bioconductor.org/packages/LINC">LINC</a>: co-expression of lincRNAs and protein-coding genes</li>
<li><a href="https://www.bioconductor.org/packages/LymphoSeq">LymphoSeq</a>: Analyze high-throughput sequencing of T and B cell receptors</li>
<li><a href="https://www.bioconductor.org/packages/philr">philr</a>: Phylogenetic partitioning based ILR transform for metagenomics data</li>
</ul>
</div>
<div id="other-applications" class="section level4">
<h4><i class="fa fa-angle-double-right"></i> Other applications</h4>
<ul>
<li><a href="https://bitbucket.org/biobakery/breadcrumbs">BreadCrumbs</a>: Collection of scripts for metagenomics analysis</li>
<li><a href="https://github.com/esnapd/DegeneratePrimerTools">DegeneratePrimerTools</a>: Utilities for Creating and Validating Degenerate primers</li>
<li><a href="https://github.com/olli0601/phyloscan">phyloscan</a>: scan phylogenies created along a genome for patterns</li>
</ul>
</div>
</div>
<div id="feedback" class="section level2">
<h2><i class="fa fa-comments"></i> Feedback</h2>
<ul class="fa-ul">
<li>
<i class="fa-li fa fa-hand-o-right"></i> Please make sure you have followed <a href="https://guangchuangyu.github.io/2016/07/how-to-bug-author/"><strong>the important guide</strong></a> before posting any issue/question
</li>
<li>
<i class="fa-li fa fa-bug"></i> For bugs or feature requests, please post to <i class="fa fa-github-alt"></i> <a href="https://github.com/GuangchuangYu/ggtree/issues">github issue</a>
</li>
<li>
<i class="fa-li fa fa-question"></i> For user questions, please post to <i class="fa fa-google"></i> <a href="https://groups.google.com/forum/#!forum/bioc-ggtree">google group</a>
</li>
<li>
<i class="fa-li fa fa-support"></i> We are also following every post tagged with <strong>ggtree</strong> on <a href="https://support.bioconductor.org">Bioconductor support site</a> and <a href="https://www.biostars.org">Biostars</a>
</li>
<li>
<i class="fa-li fa fa-commenting"></i> Join the group chat on <a href="https://twitter.com/hashtag/ggtree"><i class="fa fa-twitter fa-lg"></i></a> and <a href="http://huati.weibo.com/k/ggtree"><i class="fa fa-weibo fa-lg"></i></a>
</li>
</ul>
</div>

			

			<aside class="copyright" role="note">
				
				&copy; 2017 Released under the Artistic-2.0 license &ndash;
				
				Documentation built with
				<a href="https://www.gohugo.io" target="_blank">Hugo</a>
				using the
				<a href="http://github.com/digitalcraftsman/hugo-material-docs" target="_blank">Material</a> theme.
			</aside>

			<footer class="footer">
				



<nav class="pagination" aria-label="Footer">
  <div class="previous">
  </div>

  
  

  <div class="next">
      <a href="https://guangchuangyu.github.io/ggtree/documentation/" title="Documentation">
        <span class="direction">
          Next
        </span>
        <div class="page">
          <div class="stretch">
            <div class="title">
              Documentation
            </div>
          </div>
          <div class="button button-next" role="button" aria-label="Next">
            <i class="icon icon-forward"></i>
          </div>
        </div>
      </a>
  </div>
</nav>



			</footer>
		</div>
	</article>

	<div class="results" role="status" aria-live="polite">
		<div class="scrollable">
			<div class="wrapper">
				<div class="meta"></div>
				<div class="list"></div>
			</div>
		</div>
	</div>
</main>

    <script>
    
      var base_url = 'https:\/\/guangchuangyu.github.io\/ggtree\/';
      var repo_id  = 'GuangchuangYu\/ggtree';
    
    </script>

    <script src="https://guangchuangyu.github.io/ggtree/javascripts/application.js"></script>
    

    <script>
      /* Add headers to scrollspy */
      var headers   = document.getElementsByTagName("h2");
      var scrollspy = document.getElementById('scrollspy');

      if(scrollspy) {
        if(headers.length > 0) {
          for(var i = 0; i < headers.length; i++) {
            var li = document.createElement("li");
            li.setAttribute("class", "anchor");

            var a  = document.createElement("a");
            a.setAttribute("href", "#" + headers[i].id);
            a.setAttribute("title", headers[i].innerHTML);
            a.innerHTML = headers[i].innerHTML;

            li.appendChild(a)
            scrollspy.appendChild(li);
          }
        } else {
          scrollspy.parentElement.removeChild(scrollspy)
        }


        /* Add permanent link next to the headers */
        var headers = document.querySelectorAll("h1, h2, h3, h4, h5, h6");

        for(var i = 0; i < headers.length; i++) {
            var a = document.createElement("a");
            a.setAttribute("class", "headerlink");
            a.setAttribute("href", "#" + headers[i].id);
            a.setAttribute("title", "Permanent link")
            a.innerHTML = " ";
            headers[i].appendChild(a);
        }
      }
    </script>

    
      <script>
        (function(i,s,o,g,r,a,m){
          i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
          []).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
          m.parentNode.insertBefore(a,m)
        })(window, document,
          'script', '//www.google-analytics.com/analytics.js', 'ga');
         
        ga('create', 'UA-77901140-1', 'auto');
        ga('set', 'anonymizeIp', true);
        ga('send', 'pageview');
         
        var buttons = document.querySelectorAll('a');
        Array.prototype.map.call(buttons, function(item) {
          if (item.host != document.location.host) {
            item.addEventListener('click', function() {
              var action = item.getAttribute('data-action') || 'follow';
              ga('send', 'event', 'outbound', action, item.href);
            });
          }
        });
         
        var query = document.querySelector('.query');
        query.addEventListener('blur', function() {
          if (this.value) {
            var path = document.location.pathname;
            ga('send', 'pageview', path + '?q=' + this.value);
          }
        });
      </script>
    

    <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
  </body>
</html>