def export_legend(legend, filename='legend.png'):
    """Export legend as seperate file
    """
    fig = legend.figure
    fig.canvas.draw()
    bbox = legend.get_window_extent().transformed(fig.dpi_scale_trans.
        inverted())
    fig.savefig(filename, dpi='figure', bbox_inches=bbox)
