def __init__(self, ts, size=None, tree_height_scale=None, max_tree_height=None, node_labels=None, mutation_labels=None, node_attrs=None, edge_attrs=None, node_label_attrs=None):
    self.ts = ts
    if (size is None):
        size = ((200 * ts.num_trees), 200)
    self.image_size = size
    self.drawing = svgwrite.Drawing(size=self.image_size, debug=True)
    self.node_labels = {u: str(u) for u in range(ts.num_nodes)}
    self.axes_x_offset = 15
    self.axes_y_offset = 10
    self.treebox_x_offset = (self.axes_x_offset + 5)
    self.treebox_y_offset = (self.axes_y_offset + 5)
    x = self.treebox_x_offset
    treebox_width = (size[0] - (2 * self.treebox_x_offset))
    treebox_height = (size[1] - (2 * self.treebox_y_offset))
    tree_width = (treebox_width / ts.num_trees)
    svg_trees = [SvgTree(tree, (tree_width, treebox_height), max_tree_height='ts', node_labels=node_labels, mutation_labels=mutation_labels, tree_height_scale=tree_height_scale, node_attrs=node_attrs, edge_attrs=edge_attrs, node_label_attrs=node_label_attrs) for tree in ts.trees()]
    ticks = []
    y = self.treebox_y_offset
    defs = self.drawing.defs
    for (tree, svg_tree) in zip(ts.trees(), svg_trees):
        defs.add(svg_tree.root_group)
    for tree in ts.trees():
        tree_id = '#tree_{}'.format(tree.index)
        use = self.drawing.use(tree_id, (x, y))
        self.drawing.add(use)
        ticks.append((x, tree.interval[0]))
        x += tree_width
    ticks.append((x, ts.sequence_length))
    dwg = self.drawing
    axes_left = self.treebox_x_offset
    axes_right = (self.image_size[0] - self.treebox_x_offset)
    y = (self.image_size[1] - (2 * self.axes_y_offset))
    dwg.add(dwg.line((axes_left, y), (axes_right, y), stroke='black'))
    for (x, genome_coord) in ticks:
        delta = 5
        dwg.add(dwg.line((x, (y - delta)), (x, (y + delta)), stroke='black'))
        dwg.add(dwg.text('{:.2f}'.format(genome_coord), (x, (y + 20)), font_size=14, text_anchor='middle', font_weight='bold'))
def __init__(self, ts, size=None, tree_height_scale=None, max_tree_height=None, node_labels=None, mutation_labels=None, node_attrs=None, edge_attrs=None, node_label_attrs=None):
    self.ts = ts
    if (size is None):
        size = ((200 * ts.num_trees), 200)
    self.image_size = size
    self.drawing = svgwrite.Drawing(size=self.image_size, debug=True)
    self.node_labels = {u: str(u) for u in range(ts.num_nodes)}
    self.axes_x_offset = 15
    self.axes_y_offset = 10
    self.treebox_x_offset = (self.axes_x_offset + 5)
    self.treebox_y_offset = (self.axes_y_offset + 5)
    x = self.treebox_x_offset
    treebox_width = (size[0] - (2 * self.treebox_x_offset))
    treebox_height = (size[1] - (2 * self.treebox_y_offset))
    tree_width = (treebox_width / ts.num_trees)
    svg_trees = [SvgTree(tree, (tree_width, treebox_height), max_tree_height='ts', node_labels=node_labels, mutation_labels=mutation_labels, tree_height_scale=tree_height_scale, node_attrs=node_attrs, edge_attrs=edge_attrs, node_label_attrs=node_label_attrs) for tree in ts.trees()]
    ticks = []
    y = self.treebox_y_offset
    defs = self.drawing.defs
    for (tree, svg_tree) in zip(ts.trees(), svg_trees):
        defs.add(svg_tree.root_group)
    for tree in ts.trees():
        tree_id = '#tree_{}'.format(tree.index)
        use = self.drawing.use(tree_id, (x, y))
        self.drawing.add(use)
        ticks.append((x, tree.interval[0]))
        x += tree_width
    ticks.append((x, ts.sequence_length))
    dwg = self.drawing
    axes_left = self.treebox_x_offset
    axes_right = (self.image_size[0] - self.treebox_x_offset)
    y = (self.image_size[1] - (2 * self.axes_y_offset))
    dwg.add(dwg.line((axes_left, y), (axes_right, y), stroke='black'))
    for (x, genome_coord) in ticks:
        delta = 5
        dwg.add(dwg.line((x, (y - delta)), (x, (y + delta)), stroke='black'))
        dwg.add(dwg.text('{:.2f}'.format(genome_coord), (x, (y + 20)), font_size=14, text_anchor='middle', font_weight='bold'))