import io


def save_plot(fig, dpi, size):
    """Save the plot `fig` as SVG string with `dpi` and `size`"""
    data = io.StringIO()
    fig.set_size_inches(*size)
    fig.savefig(data, format='svg', dpi=dpi)
    data.seek(0)
    return data.read()