def __plot__(self, context, bbox, palette, *args, **kwds):
    'Draws the dendrogram on the given Cairo context\n\n        Supported keyword arguments are:\n\n          - C{orientation}: the orientation of the dendrogram. Must be one of\n            the following values: C{left-right}, C{bottom-top}, C{right-left}\n            or C{top-bottom}. Individual elements are always placed at the\n            former edge and merges are performed towards the latter edge.\n            Possible aliases: C{horizontal} = C{left-right},\n            C{vertical} = C{bottom-top}, C{lr} = C{left-right},\n            C{rl} = C{right-left}, C{tb} = C{top-bottom}, C{bt} = C{bottom-top}.\n            The default is C{left-right}.\n\n        '
    from igraph.layout import Layout
    if (self._names is None):
        self._names = [str(x) for x in xrange(self._nitems)]
    orientation = str_to_orientation(kwds.get('orientation', 'lr'), reversed_vertical=True)
    horiz = (orientation in ('lr', 'rl'))
    font_height = context.font_extents()[2]
    item_boxes = [self._item_box_size(context, horiz, idx) for idx in xrange(self._nitems)]
    ygap = (2 if (orientation == 'bt') else 0)
    xgap = (2 if (orientation == 'lr') else 0)
    item_boxes = [((x + xgap), (y + ygap)) for (x, y) in item_boxes]
    layout = Layout(([(0, 0)] * self._nitems), dim=2)
    inorder = self._traverse_inorder()
    if (not horiz):
        (x, y) = (0, 0)
        for (idx, element) in enumerate(inorder):
            layout[element] = (x, 0)
            x += max(font_height, item_boxes[element][0])
        for (id1, id2) in self._merges:
            y += 1
            layout.append((((layout[id1][0] + layout[id2][0]) / 2.0), y))
        if (orientation == 'bt'):
            layout.mirror(1)
    else:
        (x, y) = (0, 0)
        for (idx, element) in enumerate(inorder):
            layout[element] = (0, y)
            y += max(font_height, item_boxes[element][1])
        for (id1, id2) in self._merges:
            x += 1
            layout.append((x, ((layout[id1][1] + layout[id2][1]) / 2.0)))
        if (orientation == 'rl'):
            layout.mirror(0)
    maxw = max((e[0] for e in item_boxes))
    maxh = max((e[1] for e in item_boxes))
    (width, height) = (float(bbox.width), float(bbox.height))
    (delta_x, delta_y) = (0, 0)
    if horiz:
        width -= maxw
        if (orientation == 'lr'):
            delta_x = maxw
    else:
        height -= maxh
        if (orientation == 'tb'):
            delta_y = maxh
    if horiz:
        delta_y += (font_height / 2.0)
    else:
        delta_x += (font_height / 2.0)
    layout.fit_into((delta_x, delta_y, (width - delta_x), (height - delta_y)), keep_aspect_ratio=False)
    context.save()
    context.translate(bbox.left, bbox.top)
    context.set_source_rgb(0.0, 0.0, 0.0)
    context.set_line_width(1)
    if horiz:
        sgn = (0 if (orientation == 'rl') else (- 1))
        for idx in xrange(self._nitems):
            x = (layout[idx][0] + (sgn * item_boxes[idx][0]))
            y = (layout[idx][1] - (item_boxes[idx][1] / 2.0))
            self._plot_item(context, horiz, idx, x, y)
    else:
        sgn = (1 if (orientation == 'bt') else 0)
        for idx in xrange(self._nitems):
            x = (layout[idx][0] - (item_boxes[idx][0] / 2.0))
            y = (layout[idx][1] + (sgn * item_boxes[idx][1]))
            self._plot_item(context, horiz, idx, x, y)
    if (not horiz):
        for (idx, (id1, id2)) in enumerate(self._merges):
            (x0, y0) = layout[id1]
            (x1, y1) = layout[id2]
            (x2, y2) = layout[(idx + self._nitems)]
            context.move_to(x0, y0)
            context.line_to(x0, y2)
            context.line_to(x1, y2)
            context.line_to(x1, y1)
            context.stroke()
    else:
        for (idx, (id1, id2)) in enumerate(self._merges):
            (x0, y0) = layout[id1]
            (x1, y1) = layout[id2]
            (x2, y2) = layout[(idx + self._nitems)]
            context.move_to(x0, y0)
            context.line_to(x2, y0)
            context.line_to(x2, y1)
            context.line_to(x1, y1)
            context.stroke()
    context.restore()
Draws the dendrogram on the given Cairo context

Supported keyword arguments are:

  - C{orientation}: the orientation of the dendrogram. Must be one of
    the following values: C{left-right}, C{bottom-top}, C{right-left}
    or C{top-bottom}. Individual elements are always placed at the
    former edge and merges are performed towards the latter edge.
    Possible aliases: C{horizontal} = C{left-right},
    C{vertical} = C{bottom-top}, C{lr} = C{left-right},
    C{rl} = C{right-left}, C{tb} = C{top-bottom}, C{bt} = C{bottom-top}.
    The default is C{left-right}.
def __plot__(self, context, bbox, palette, *args, **kwds):
    'Draws the dendrogram on the given Cairo context\n\n        Supported keyword arguments are:\n\n          - C{orientation}: the orientation of the dendrogram. Must be one of\n            the following values: C{left-right}, C{bottom-top}, C{right-left}\n            or C{top-bottom}. Individual elements are always placed at the\n            former edge and merges are performed towards the latter edge.\n            Possible aliases: C{horizontal} = C{left-right},\n            C{vertical} = C{bottom-top}, C{lr} = C{left-right},\n            C{rl} = C{right-left}, C{tb} = C{top-bottom}, C{bt} = C{bottom-top}.\n            The default is C{left-right}.\n\n        '
    from igraph.layout import Layout
    if (self._names is None):
        self._names = [str(x) for x in xrange(self._nitems)]
    orientation = str_to_orientation(kwds.get('orientation', 'lr'), reversed_vertical=True)
    horiz = (orientation in ('lr', 'rl'))
    font_height = context.font_extents()[2]
    item_boxes = [self._item_box_size(context, horiz, idx) for idx in xrange(self._nitems)]
    ygap = (2 if (orientation == 'bt') else 0)
    xgap = (2 if (orientation == 'lr') else 0)
    item_boxes = [((x + xgap), (y + ygap)) for (x, y) in item_boxes]
    layout = Layout(([(0, 0)] * self._nitems), dim=2)
    inorder = self._traverse_inorder()
    if (not horiz):
        (x, y) = (0, 0)
        for (idx, element) in enumerate(inorder):
            layout[element] = (x, 0)
            x += max(font_height, item_boxes[element][0])
        for (id1, id2) in self._merges:
            y += 1
            layout.append((((layout[id1][0] + layout[id2][0]) / 2.0), y))
        if (orientation == 'bt'):
            layout.mirror(1)
    else:
        (x, y) = (0, 0)
        for (idx, element) in enumerate(inorder):
            layout[element] = (0, y)
            y += max(font_height, item_boxes[element][1])
        for (id1, id2) in self._merges:
            x += 1
            layout.append((x, ((layout[id1][1] + layout[id2][1]) / 2.0)))
        if (orientation == 'rl'):
            layout.mirror(0)
    maxw = max((e[0] for e in item_boxes))
    maxh = max((e[1] for e in item_boxes))
    (width, height) = (float(bbox.width), float(bbox.height))
    (delta_x, delta_y) = (0, 0)
    if horiz:
        width -= maxw
        if (orientation == 'lr'):
            delta_x = maxw
    else:
        height -= maxh
        if (orientation == 'tb'):
            delta_y = maxh
    if horiz:
        delta_y += (font_height / 2.0)
    else:
        delta_x += (font_height / 2.0)
    layout.fit_into((delta_x, delta_y, (width - delta_x), (height - delta_y)), keep_aspect_ratio=False)
    context.save()
    context.translate(bbox.left, bbox.top)
    context.set_source_rgb(0.0, 0.0, 0.0)
    context.set_line_width(1)
    if horiz:
        sgn = (0 if (orientation == 'rl') else (- 1))
        for idx in xrange(self._nitems):
            x = (layout[idx][0] + (sgn * item_boxes[idx][0]))
            y = (layout[idx][1] - (item_boxes[idx][1] / 2.0))
            self._plot_item(context, horiz, idx, x, y)
    else:
        sgn = (1 if (orientation == 'bt') else 0)
        for idx in xrange(self._nitems):
            x = (layout[idx][0] - (item_boxes[idx][0] / 2.0))
            y = (layout[idx][1] + (sgn * item_boxes[idx][1]))
            self._plot_item(context, horiz, idx, x, y)
    if (not horiz):
        for (idx, (id1, id2)) in enumerate(self._merges):
            (x0, y0) = layout[id1]
            (x1, y1) = layout[id2]
            (x2, y2) = layout[(idx + self._nitems)]
            context.move_to(x0, y0)
            context.line_to(x0, y2)
            context.line_to(x1, y2)
            context.line_to(x1, y1)
            context.stroke()
    else:
        for (idx, (id1, id2)) in enumerate(self._merges):
            (x0, y0) = layout[id1]
            (x1, y1) = layout[id2]
            (x2, y2) = layout[(idx + self._nitems)]
            context.move_to(x0, y0)
            context.line_to(x2, y0)
            context.line_to(x2, y1)
            context.line_to(x1, y1)
            context.stroke()
    context.restore()