Skip to content

Instantly share code, notes, and snippets.

@terrycojones
Created October 29, 2015 12:07
Show Gist options
  • Save terrycojones/4c34cff3fbb3e83192da to your computer and use it in GitHub Desktop.
Save terrycojones/4c34cff3fbb3e83192da to your computer and use it in GitHub Desktop.
def draw(tree, label_func=str, do_show=True, show_confidence=True,
# For power users
axes=None, branch_labels=None, label_colors=None,
*args, **kwargs):
if label_colors:
if callable(label_colors):
def get_label_color(label):
return label_colors(label)
else:
# label_colors is presumed to be a dict
def get_label_color(label):
return label_colors.get(label, 'black')
else:
def get_label_color(label):
return 'black'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment