|
66 | 66 | <li class="toctree-l2 current"><a class="current reference internal" href="#">Phylogenetics with Bio.Phylo</a><ul> |
67 | 67 | <li class="toctree-l3"><a class="reference internal" href="#demo-whats-in-a-tree">Demo: What’s in a Tree?</a><ul> |
68 | 68 | <li class="toctree-l4"><a class="reference internal" href="#coloring-branches-within-a-tree">Coloring branches within a tree</a></li> |
| 69 | +<li class="toctree-l4"><a class="reference internal" href="#drawing-trees-with-iplotx">Drawing trees with iplotx</a></li> |
| 70 | +<li class="toctree-l4"><a class="reference internal" href="#writing-tree-to-file">Writing tree to file</a></li> |
69 | 71 | </ul> |
70 | 72 | </li> |
71 | 73 | <li class="toctree-l3"><a class="reference internal" href="#i-o-functions">I/O functions</a></li> |
@@ -299,6 +301,29 @@ <h3>Coloring branches within a tree<a class="headerlink" href="#coloring-branche |
299 | 301 | well as its descendents. The common ancestor of E and F turns out to be |
300 | 302 | just under the root, and with this coloring we can see exactly where the |
301 | 303 | root of the tree is.</p> |
| 304 | +</section> |
| 305 | +<section id="drawing-trees-with-iplotx"> |
| 306 | +<h3>Drawing trees with iplotx<a class="headerlink" href="#drawing-trees-with-iplotx" title="Link to this heading"></a></h3> |
| 307 | +<p>For users seeking advanced styling options, Bio.Phylo trees are natively |
| 308 | +supported by the external library <code class="docutils literal notranslate"><span class="pre">iplotx</span></code>:</p> |
| 309 | +<p><a class="reference external" href="https://iplotx.readthedocs.io/en/latest/">https://iplotx.readthedocs.io/en/latest/</a></p> |
| 310 | +<p><code class="docutils literal notranslate"><span class="pre">iplotx</span></code> enables customisation of many aspects of the visualisation, |
| 311 | +including layout, vertex and branch properties, cascading backgrounds, |
| 312 | +and labels. Here is a self-contained example.</p> |
| 313 | +<div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">from</span><span class="w"> </span><span class="nn">Bio</span><span class="w"> </span><span class="kn">import</span> <span class="n">Phylo</span> |
| 314 | +<span class="gp">>>> </span><span class="kn">import</span><span class="w"> </span><span class="nn">iplotx</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">ipx</span> |
| 315 | +<span class="gp">>>> </span><span class="n">tree</span> <span class="o">=</span> <span class="n">Phylo</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="s2">"simple.dnd"</span><span class="p">,</span> <span class="s2">"newick"</span><span class="p">)</span> |
| 316 | +<span class="gp">>>> </span><span class="n">ipx</span><span class="o">.</span><span class="n">tree</span><span class="p">(</span><span class="n">tree</span><span class="p">,</span> <span class="n">leaf_deep</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">leaf_labels</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="s2">"tree"</span><span class="p">)</span> |
| 317 | +</pre></div> |
| 318 | +</div> |
| 319 | +<figure class="align-default" id="fig-phylo-color-iplotx"> |
| 320 | +<a class="reference internal image-reference" href="../_images/phylo-color-iplotx.png"><img alt="A colorized tree drawn with ``iplotx.tree``." src="../_images/phylo-color-iplotx.png" style="width: 70.0%;" /> |
| 321 | +</a> |
| 322 | +</figure> |
| 323 | +<p><code class="docutils literal notranslate"><span class="pre">iplotx</span></code> has an extensive <a class="reference external" href="https://iplotx.readthedocs.io/en/latest/gallery/index.html">gallery of examples</a>.</p> |
| 324 | +</section> |
| 325 | +<section id="writing-tree-to-file"> |
| 326 | +<h3>Writing tree to file<a class="headerlink" href="#writing-tree-to-file" title="Link to this heading"></a></h3> |
302 | 327 | <p>My, we’ve accomplished a lot! Let’s take a break here and save our work. |
303 | 328 | Call the <code class="docutils literal notranslate"><span class="pre">write</span></code> function with a file name or handle — here we use |
304 | 329 | standard output, to see what would be written — and the format |
|
0 commit comments