File: render_tree_images.py

package info (click to toggle)
python-ete3 3.1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,152 kB
  • sloc: python: 52,375; javascript: 12,959; xml: 4,903; ansic: 69; sql: 65; makefile: 26; sh: 7
file content (13 lines) | stat: -rw-r--r-- 517 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
from ete3 import Tree
t = Tree()
# Generate a random tree with 50 leaves
t.populate(50)
# Render  tree in png and pdf format using the default size
t.render("./random_tree.png")
t.render("./random_tree.pdf")
# Render tree in pdf setting a custom width. height will be imputed
t.render("./random_tree.pdf", w=300)
# Render tree in pdf setting a custom height. Width will be imputed
t.render("./random_tree.pdf", h=600)
# Render tree in pdf setting a custom width and height
t.render("./random_tree.pdf", w=300, h=300)