import matplotlib.pyplot as plt


# Function to plot the data together with an error bar
def plot_data_error(
    x,
    y,
    yerr,
    color,
    title="default_title",
    xlabel=r"$\text{c}_{\text{substrate}}$ (mM)",
    ylabel=r"specific activity ($\text{U/g}_{\text{CDW}}$)",
    legend_label_y="default",
):  # orange: default values, if nothing else if given
    plt.errorbar(
        x,
        y,
        yerr=yerr,
        color=color,
        marker="o",
        linestyle="-",
        label=legend_label_y,
        capsize=5,
        ecolor="black",
    )
    plt.title(title)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.grid(True)
    plt.legend()


def plot_data_error_singlepoints(
    x,
    y,
    yerr,
    color,
    title="default_title",
    xlabel=r"$\text{c}_{\text{substrate}}$ (mM)",
    ylabel=r"specific activity ($\text{U/g}_{\text{CDW}}$)",
    legend_label_y=None,
):  # orange: default values, if nothing else if given
    plt.errorbar(
        x,
        y,
        yerr=yerr,
        color=color,
        marker="o",
        linestyle="None",
        label=legend_label_y,
        capsize=5,
        ecolor="black",
        markersize=15,
    )
    plt.title(title)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.grid(True)
    # plt.legend()


# Funtion Plottet Datenpunkte ohne Fehlerbalken
def plot_data(
    x,
    y,
    title="default_title",
    legend_label_y=None,
    xlabel=r"$\text{c}_{\text{substrate}}$ (mM)",
    ylabel=r"specific activity ($\text{U/g}_{\text{CDW}}$)",
):  # orange: default values, if nothing else if given
    plt.plot(x, y, marker=None, linestyle="-", label=legend_label_y, color="black")
    plt.grid(True)
    plt.title(title)
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    # plt.legend()
