def _draw(self):
    if self.use_ascii:
        left_child = '+'
        right_child = '+'
        mid_parent = '+'
        mid_parent_child = '+'
        mid_child = '+'
    elif (self.orientation == TOP):
        left_child = '┏'
        right_child = '┓'
        mid_parent = '┻'
        mid_parent_child = '╋'
        mid_child = '┳'
    else:
        left_child = '┗'
        right_child = '┛'
        mid_parent = '┳'
        mid_parent_child = '╋'
        mid_child = '┻'
    for u in self.tree.nodes():
        xu = self.traversal_position[u]
        yu = self.time_position[u]
        label = to_np_unicode(self.node_labels[u])
        label_len = label.shape[0]
        label_x = self.label_x[u]
        assert (label_x >= 0)
        self.canvas[yu, label_x:(label_x + label_len)] = label
        children = self.tree.children(u)
        if (len(children) > 0):
            if (len(children) == 1):
                yv = self.time_position[children[0]]
                self.canvas[yv:yu, xu] = self.vertical_line_char
            else:
                left = min((self.traversal_position[v] for v in children))
                right = max((self.traversal_position[v] for v in children))
                y = (yu - 1)
                self.canvas[y, (left + 1):right] = self.horizontal_line_char
                self.canvas[(y, xu)] = mid_parent
                for v in children:
                    xv = self.traversal_position[v]
                    yv = self.time_position[v]
                    self.canvas[yv:yu, xv] = self.vertical_line_char
                    mid_char = (mid_parent_child if (xv == xu) else mid_child)
                    self.canvas[(y, xv)] = mid_char
                self.canvas[(y, left)] = left_child
                self.canvas[(y, right)] = right_child
    if (self.orientation == TOP):
        self.canvas = np.flip(self.canvas, axis=0)
        flipped_time_position = {u: ((self.height - y) - 1) for (u, y) in self.time_position.items()}
        self.time_position = flipped_time_position
def _draw(self):
    if self.use_ascii:
        left_child = '+'
        right_child = '+'
        mid_parent = '+'
        mid_parent_child = '+'
        mid_child = '+'
    elif (self.orientation == TOP):
        left_child = '┏'
        right_child = '┓'
        mid_parent = '┻'
        mid_parent_child = '╋'
        mid_child = '┳'
    else:
        left_child = '┗'
        right_child = '┛'
        mid_parent = '┳'
        mid_parent_child = '╋'
        mid_child = '┻'
    for u in self.tree.nodes():
        xu = self.traversal_position[u]
        yu = self.time_position[u]
        label = to_np_unicode(self.node_labels[u])
        label_len = label.shape[0]
        label_x = self.label_x[u]
        assert (label_x >= 0)
        self.canvas[yu, label_x:(label_x + label_len)] = label
        children = self.tree.children(u)
        if (len(children) > 0):
            if (len(children) == 1):
                yv = self.time_position[children[0]]
                self.canvas[yv:yu, xu] = self.vertical_line_char
            else:
                left = min((self.traversal_position[v] for v in children))
                right = max((self.traversal_position[v] for v in children))
                y = (yu - 1)
                self.canvas[y, (left + 1):right] = self.horizontal_line_char
                self.canvas[(y, xu)] = mid_parent
                for v in children:
                    xv = self.traversal_position[v]
                    yv = self.time_position[v]
                    self.canvas[yv:yu, xv] = self.vertical_line_char
                    mid_char = (mid_parent_child if (xv == xu) else mid_child)
                    self.canvas[(y, xv)] = mid_char
                self.canvas[(y, left)] = left_child
                self.canvas[(y, right)] = right_child
    if (self.orientation == TOP):
        self.canvas = np.flip(self.canvas, axis=0)
        flipped_time_position = {u: ((self.height - y) - 1) for (u, y) in self.time_position.items()}
        self.time_position = flipped_time_position