Пример #1
0
def rectangle(height, color_name):
    s_fmt = fmt.combine_tikz_strs([
        fmt.line_width(line_width),
        fmt.fill_color(color_name),
        fmt.rounded_corners(rectangle_roundness)
    ])
    return stz.rectangle_from_width_and_height([0, 0], height, width, s_fmt)
Пример #2
0
def rectangle_with_latex(width,
                         expr,
                         rectangle_tikz_str="",
                         latex_tikz_str=""):
    r_fmt = fmt.combine_tikz_strs([
        # fmt.alignment("center"),
        fmt.rounded_corners(roundness_in_cm),
        fmt.line_width(line_width),
        rectangle_tikz_str
    ])
    l_fmt = fmt.combine_tikz_strs([latex_tikz_str])
    r = stz.rectangle_from_width_and_height([0, 0], square_side, width, r_fmt)
    l = stz.latex(stz.center_coords(r), expr, l_fmt)
    return [r, l]
Пример #3
0
def label_small_node(label, e_small, angle, distance, label_width):
    s_fmt = fmt.combine_tikz_strs([
        fmt.rounded_corners(rectangle_roundness),
        fmt.fill_color_with_no_line('gray!20')
    ])
    s_fmt_t = fmt.fill_color_with_no_line('gray!20')
    r = stz.rectangle_from_width_and_height([0, 0], 1.8 * node_radius,
                                            label_width, s_fmt)
    cs = stz.center_coords(e_small)
    cs_label = stz.coords_on_circle(cs, distance, angle)
    stz.translate_bbox_center_to_coords(r, cs_label)
    l = stz.latex(cs_label, label)
    t = stz.closed_path([
        stz.coords_on_circle(cs, filled_node_radius, angle), cs_label,
        stz.coords_on_circle(cs_label, triangle_radius,
                             angle + 180.0 + triangle_angle_delta)
    ], s_fmt_t)
    return [r, t, l]
Пример #4
0
])

property_s_fmt = fmt.combine_tikz_strs([
    fmt.line_width(line_width),
])

module_s_fmt = fmt.combine_tikz_strs([
    fmt.line_width(line_width),
])

hyperp_s_fmt = fmt.combine_tikz_strs([
    fmt.line_width(line_width),
])

frame_s_fmt = fmt.combine_tikz_strs([
    fmt.rounded_corners(frame_roundness),
    fmt.line_width(frame_line_width),
])

unassigned_h_s_fmt = fmt.combine_tikz_strs([
    fmt.anchor("left_center"),
])

assigned_h_s_fmt = fmt.combine_tikz_strs([
    fmt.anchor("left_center"),
])


def input(name):
    x1 = io_short_side / 2.0
    x2 = io_long_side / 2.0
Пример #5
0
    "ff_color": (194, 232, 247),
    "softmax_color": (203, 231, 207),
    "linear_color": (220, 223, 240),
    "gray_bbox_color": (243, 243, 244)
}

s_arr = fmt.combine_tikz_strs(
    [fmt.line_width(line_width),
     fmt.arrow_heads("end")])

s_lw = fmt.combine_tikz_strs([fmt.line_width(line_width)])

s_con = s_bbox = fmt.combine_tikz_strs([
    fmt.arrow_heads("end"),
    fmt.line_width(line_width),
    fmt.rounded_corners(connector_roundness)
])

s_bbox = fmt.combine_tikz_strs([
    fmt.fill_color("gray_bbox_color"),
    fmt.line_width(line_width),
    fmt.rounded_corners(bbox_roundness)
])


def trident_coords(e):
    top_left_cs, bottom_right_cs = stz.bbox(e)
    center_cs = stz.bottom_center_coords(top_left_cs, bottom_right_cs)
    left_cs = stz.translate_coords_horizontally(center_cs,
                                                -trident_alpha * width / 2.0)
    right_cs = stz.translate_coords_horizontally(center_cs,
Пример #6
0
def box_with_text(s):
    s_fmt = fmt.rounded_corners(box_roundness)
    return [
        stz.rectangle([0, 0], [box_width, -box_height], s_fmt),
        stz.latex([box_width / 2.0, -box_height / 2.0], s)
    ]