def plot_digraph(graph, axes=None, r_node=None):
    """
    Returns a DiGraph object to a set of matplotlib axes.

    Returns a matplotlib axes object.
    """
    import matplotlib.pyplot as plt
    import matplotlib.lines as lines
    import matplotlib.patches as patches
    limits = [None, None, None, None]
    ax = axes if axes is not None else plt.gca()
    ax.set_frame_on(False)
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    xmin = ymin = 1
    xmax = ymax = 0
    if r_node is None:
        w = 0.85 / len(graph)
    else:
        w = r_node
    fArrow = 0.8
    for node in graph:
        for mode in node.edgo:
            x1, y1, x2, y2 = node.x, node.y, mode.x, mode.y
            line = lines.Line2D((x1, x2), (y1, y2), lw=2, color=(0, 0, 0),
                alpha=0.5, zorder=0)
            ax.add_line(line)
            ax.add_patch(patches.FancyArrowPatch((x1, y1), (x1 + fArrow * (
                x2 - x1), y1 + fArrow * (y2 - y1)), arrowstyle='->',
                mutation_scale=60, color=(0, 0, 0), alpha=0.5, zorder=0))
        xmin = min(xmin, node.x)
        xmax = max(xmax, node.x)
        ymin = min(ymin, node.y)
        ymax = max(ymax, node.y)
    p = 0.8
    if limits[0] is None:
        limits[0] = xmin - p * w
    if limits[1] is None:
        limits[1] = xmax + p * w
    if limits[2] is None:
        limits[2] = ymin - p * w
    if limits[3] is None:
        limits[3] = ymax + p * w
    ax.set_xlim(limits[0], limits[1])
    ax.set_ylim(limits[2], limits[3])
    for node in graph:
        e = patches.Ellipse(xy=(node.x, node.y), width=w, height=w, angle=0,
            zorder=1)
        e.set_clip_box(ax.bbox)
        e.set_alpha(node.rgba[3])
        e.set_facecolor(node.rgba[0:3])
        ax.add_artist(e)
        if node.label is not None:
            ax.text(node.x, node.y, node.label, horizontalalignment=
                'center', zorder=2)
    return ax
