コード例 #1
0
ファイル: xlnet.py プロジェクト: sidney1994/sane_tikz
def connect(e_from, e_to):
    cs_from = stz.coords_from_bbox_with_fn(e_from, stz.top_center_coords)
    cs_to = stz.coords_from_bbox_with_fn(e_to, stz.bottom_center_coords)
    s_fmt = fmt.combine_tikz_strs(
        [fmt.line_width(line_width),
         fmt.arrow_heads("end")])
    return stz.line_segment(cs_from, cs_to, s_fmt)
コード例 #2
0
def segment(length, label_str, left_tick_label_str, right_tick_label_str):
    seg = stz.line_segment([0, 0], [length, 0])
    left_tick = stz.centered_vertical_line_segment([0, 0], tick_length)
    right_tick = stz.centered_vertical_line_segment([length, 0], tick_length)
    left_tick_label = stz.latex([0, 0], left_tick_label_str)
    right_tick_label = stz.latex([0, 0], right_tick_label_str)
    stz.place_above_and_align_to_the_center(left_tick_label, left_tick,
                                            tick_label_spacing)
    stz.place_above_and_align_to_the_center(right_tick_label, right_tick,
                                            tick_label_spacing)
    seg_label = stz.latex([-label_spacing, 0], label_str)
    return [
        seg, left_tick, right_tick, left_tick_label, right_tick_label, seg_label
    ]
コード例 #3
0
def connect_horizontally(e_from, e_to):
    s_fmt = fmt.arrow_heads("end")
    cs_from = stz.coords_from_bbox_with_fn(e_from, stz.right_center_coords)
    cs_to = stz.coords_from_bbox_with_fn(e_to, stz.left_center_coords)
    return stz.line_segment(cs_from, cs_to, s_fmt)
コード例 #4
0
ファイル: transformer.py プロジェクト: sidney1994/sane_tikz
def arrow_out(e):
    from_cs = stz.coords_from_bbox_with_fn(e, stz.top_center_coords)
    to_cs = stz.translate_coords_vertically(from_cs, arrow_length)
    return stz.line_segment(from_cs, to_cs, s_arr)
コード例 #5
0
ファイル: transformer.py プロジェクト: sidney1994/sane_tikz
def arrow_in(e):
    to_cs = stz.coords_from_bbox_with_fn(e, stz.bottom_center_coords)
    from_cs = stz.translate_coords_vertically(to_cs, -arrow_length)
    return stz.line_segment(from_cs, to_cs, s_arr)
コード例 #6
0
ファイル: transformer.py プロジェクト: sidney1994/sane_tikz
def connect_straight_with_arrow(e_from, e_to):
    from_cs = stz.coords_from_bbox_with_fn(e_from, stz.top_center_coords)
    to_cs = stz.coords_from_bbox_with_fn(e_to, stz.bottom_center_coords)
    return stz.line_segment(from_cs, to_cs, s_arr)
コード例 #7
0
ファイル: transformer.py プロジェクト: sidney1994/sane_tikz
def connect_straight_horizontal(e_from, e_to):
    from_cs = stz.coords_from_bbox_with_fn(e_from, stz.right_center_coords)
    to_cs = stz.coords_from_bbox_with_fn(e_to, stz.left_center_coords)
    return stz.line_segment(from_cs, to_cs, s_lw)
コード例 #8
0
    stz.coords_on_circle([0, 0], pentagon_radius, 90.0 + i * (360.0 / 5))
    for i in range(5)
]
e = stz.closed_path(cs)

origin_cs = stz.translate_coords_horizontally(cs[2], -1.0)
x_end_cs = stz.translate_coords_horizontally(origin_cs, x_axis_length)
y_end_cs = stz.translate_coords_vertically(origin_cs, y_axis_length)
x_start_cs = stz.translate_coords_horizontally(origin_cs, -extra_length)
y_start_cs = stz.translate_coords_vertically(origin_cs, -extra_length)
x_label_cs = stz.translate_coords_vertically(x_end_cs, -label_spacing)
y_label_cs = stz.translate_coords_horizontally(y_end_cs, -label_spacing)
origin_label_cs = stz.translate_coords_diagonally(origin_cs, -label_spacing)

axes = [
    stz.line_segment(x_start_cs, x_end_cs, s_fmt),
    stz.line_segment(y_start_cs, y_end_cs, s_fmt)
]

labels = [
    stz.latex([cs[0][0], cs[0][1] + label_spacing], "$C$"),
    stz.latex([cs[1][0] - label_spacing, cs[1][1]], "$B$"),
    stz.latex([cs[2][0], cs[2][1] - a_circle_radius - label_spacing],
              "$A(1, 0)$"),
    stz.latex([cs[3][0], cs[3][1] - label_spacing], "$E$"),
    stz.latex([cs[4][0] + label_spacing, cs[4][1]], "$D$"),
    stz.circle(cs[2], a_circle_radius, f_fmt),
    stz.latex(x_label_cs, "$x$"),
    stz.latex(y_label_cs, "$y$"),
    stz.latex(origin_label_cs, "$O$"),
]
コード例 #9
0
def connect_hyperp_to_hyperp(h_from, h_to):
    return stz.line_segment(
        stz.coords_from_bbox_with_fn(h_from[:2], stz.right_center_coords),
        stz.coords_from_bbox_with_fn(h_to[3], stz.top_center_coords),
        connect_s_fmt)
コード例 #10
0
def connect_hyperp_to_module(h, m, property_idx):
    return stz.line_segment(
        stz.coords_from_bbox_with_fn(h[:2], stz.left_center_coords),
        stz.coords_from_bbox_with_fn(m[3][property_idx],
                                     stz.right_center_coords), connect_s_fmt)
コード例 #11
0
def connect_modules(m_from, m_to, output_idx, input_idx):
    return stz.line_segment(
        stz.coords_from_bbox_with_fn(m_from[2][output_idx],
                                     stz.bottom_center_coords),
        stz.coords_from_bbox_with_fn(m_to[1][input_idx],
                                     stz.top_center_coords), connect_s_fmt)