file_name_list_O = ['TGrid_Mass100000.0_age5.48_zStar-2.1_zGas0.008.ele_O',
                    'TGrid_Mass200000.0_age5.48_zStar-2.1_zGas0.008.ele_O']
z_list = ['100000', '200000']
ions_list_S = ['S+', 'S+2', 'S+3']
ions_labels_S = [r'$S^{+}$', r'$S^{2+}$', r'$S^{3+}$']
ions_list_O = ['O+', 'O+2']
ions_labels_O = [r'$O^{+}$', r'$O^{2+}$']
labels_coords_S = [[(1.60e18, 0.98), (2.35e18, 0.98)],
                   [(1.0e18, 0.72), (1.77e18, 0.72)],
                   [(0.75e18, 0.000005), (2.0e18, 0.015)]]
labels_coords_O = [[(1.55e18, 0.5), (2.3e18, 0.5)],
                   [(1.03e18, 0.6), (1.8e18, 0.6)]]


# Generate the color map
dz.gen_colorList(0, 5)
# ions_colors_S = [dz.get_color(0), dz.get_color(1), dz.get_color(2)]
# ions_colors_O = [dz.get_color(3), dz.get_color(4)]

ions_colors_S = ['tab:orange', 'tab:red', 'tab:brown']
ions_colors_O = ['tab:blue', 'tab:green']

line_type = ['--', '-']

for i in range(len(file_name_list_S)):

    file_name = file_name_list_S[i]

    elemIon_df = pd.read_csv(folder_data + file_name, sep='\t')

    for j in range(len(ions_list_S)):
    sheetname='Sheet1')

#Define plot frame and colors
size_dict = {
    'figure.figsize': (18, 8),
    'axes.labelsize': 28,
    'legend.fontsize': 35,
    'font.family': 'Times New Roman',
    'mathtext.default': 'regular',
    'xtick.labelsize': 28,
    'ytick.labelsize': 28
}
dz.FigConf(plotStyle='colorblind', plotSize=size_dict)

# Generate the color map
dz.gen_colorList(0, df.index.size)

marker_dict = {'Peimbert': 's', 'Skillman': '^', 'Izotov': 'o'}

#Loop through the lines
for i in range(df.index.size):

    author, value, error, year, comments, upper_limit, group = df.iloc[
        i].values

    marker_type = '_' if group not in marker_dict else marker_dict[group]

    if error < 0.236:
        if author == 'Planck collaboration' and year == 2015:
            label = r'Planck collaboration 2018: $Y_{P}=0.24672^{-(0.00012)0.00061}_{ +(0.00011)0.00061}$'
            dz.Axis.axhspan(value - error,
#Perform the linear regression---------------------------
from dazer_methods import Dazer
from numpy import nanmean, nanstd, min as np_min, linspace, max as np_max, arange
from uncertainties import ufloat
from uncertainties import unumpy
from lib.Math_Libraries.FittingTools import bces_regression

#Generate dazer object
dz = Dazer()

# Generate the color map
dz.gen_colorList(0, 4)

#Define plot frame and colors
size_dict = {
    'axes.labelsize': 35,
    'legend.fontsize': 24,
    'font.family': 'Times New Roman',
    'mathtext.default': 'regular',
    'xtick.labelsize': 30,
    'ytick.labelsize': 30
}
dz.FigConf(plotSize=size_dict)

#Load catalogue dataframe
catalogue_dict = dz.import_catalogue()

#Declare data for the analisis
AbundancesFileExtension = '_' + catalogue_dict[
    'Datatype'] + '_linesLog_reduc.txt'
catalogue_df = dz.load_excel_DF(