def create_legend(info, c, option="clean", use_index=False):
    """creating more informative legends"""

    logging.debug("    - creating legends")
    mass, loading, label = info.loc[c, ["masses", "loadings", "labels"]]

    if use_index or not label:
        label = c.split("_")
        label = "_".join(label[1:])

    if option == "clean":
        return label

    if option == "mass":
        label = f"{label} ({mass:.2f} mg)"
    elif option == "loading":
        label = f"{label} ({loading:.2f} mg/cm2)"
    elif option == "all":
        label = f"{label} ({mass:.2f} mg) ({loading:.2f} mg/cm2)"

    return label
def create_legend ( info , c , option = "clean" , use_index = False ) : logging . debug ( "    - creating legends" ) mass , loading , label = info . loc [ c , [ "masses" , "loadings" , "labels" ] ] if use_index or not label : label = c . split ( "_" ) label = "_" . join ( label [ 1 : ] ) if option == "clean" : return label if option == "mass" : label = f"{label} ({mass:.2f} mg)" elif option == "loading" : label = f"{label} ({loading:.2f} mg/cm2)" elif option == "all" : label = f"{label} ({mass:.2f} mg) ({loading:.2f} mg/cm2)" return label
creating more informative legends