import re


def get_fig_name(title, tag, legends=[]):
    """Get the name of the figure with the title and tag."""
    fig_name = "_".join(re.split("/|-|_|,", title) + legends).replace(" ", "")
    return f"{fig_name}_generalization_{tag}.pdf"