Esempio n. 1
0
def draw_labels_ftree(T, N, context, v_to_location):
    """
    Use degree anchors for label placement.
    """
    for v in Ftree.T_to_order(T):
        if v not in N:
            continue
        label = N[v]
        # get the parameters for the label
        theta = DrawEigenLacing.get_free_angle_ftree(T, v, v_to_location)
        x, y = v_to_location[v]
        # draw the text relative to the location
        theta += math.pi
        float_degree = ((theta % (2 * math.pi)) * 360) / (2 * math.pi)
        degree = int(math.floor(float_degree))
        #style = 'anchor=%s,inner sep=1pt' % degree
        style = 'anchor=%s' % degree
        context.add_line('\\node[%s] at (%.4f,%.4f) {%s};' %
                         (style, x, y, label))
Esempio n. 2
0
def draw_labels_ftree(T, N, context, v_to_location):
    """
    Use degree anchors for label placement.
    """
    for v in Ftree.T_to_order(T):
        if v not in N:
            continue
        label = N[v]
        # get the parameters for the label
        theta = DrawEigenLacing.get_free_angle_ftree(T, v, v_to_location)
        x, y = v_to_location[v]
        # draw the text relative to the location
        theta += math.pi
        float_degree = ((theta % (2 * math.pi)) * 360) / (2 * math.pi)
        degree = int(math.floor(float_degree))
        #style = 'anchor=%s,inner sep=1pt' % degree
        style = 'anchor=%s' % degree
        context.add_line(
                '\\node[%s] at (%.4f,%.4f) {%s};' % (
                    style, x, y, label))