Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding y_axis scale function #318

Open
wants to merge 12 commits into
base: ete3
Choose a base branch
from
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ test_tmp/
# Coverage files
.coverage
htmlcov/
.idea/workspace.xml
bash_colors.sh
.idea/ete.iml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
15 changes: 15 additions & 0 deletions ete3/treeview/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def __setitem__(self, i, v):
#def clear(self):
# super(NodeStyle, self).__setitem__("_faces", {})


class TreeStyle(object):
""".. versionadded:: 2.1

Expand Down Expand Up @@ -362,6 +363,14 @@ class TreeStyle(object):
:param True show_scale: Include the scale legend in the tree
image

:param False y_axis['show']: Include calculated y scale legend in the tree
image (relative branch length)

:param linear y_axis['scale_type']: Defined the type of the y_axis scale log/linear

:param 1 y_axis['scale_length']: Sets the length of the y_axis scale
(recomended to set to: root.get_farthest_leaf()[1], the depth of the farthest leaf)

:param None scale_length: Scale length to be used as reference scale bar
when visualizing tree. None = automatically adjusted.

Expand Down Expand Up @@ -528,6 +537,12 @@ def __init__(self):
self.show_scale = True
self.scale_length = None

# Draw Y_axis scale
self.y_axis = dict()
self.y_axis['show'] = False
self.y_axis['scale_type'] = 'linear'
self.y_axis['scale_length'] = 1

# Initialize aligned face headers
self.aligned_header = FaceContainer()
self.aligned_foot = FaceContainer()
Expand Down