Skip to content

Commit

Permalink
adding y_axis scale function.
Browse files Browse the repository at this point in the history
The function gives the option to ass full y axis scale to the tree in linear or log setting.
  • Loading branch information
niki_main committed Jan 16, 2018
1 parent 61e0390 commit 27c2a99
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 72 deletions.
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

0 comments on commit 27c2a99

Please sign in to comment.