import pandas as pd
import matplotlib.pyplot as plt
loglist = ['log_'+nome+'.csv' for nome in ['valerio','alessiaS', 'edoardo', 'Silvia', 'Magda', 'Damiano', 'Andrea', 'Martino', 'Maria1', 'Maria2'] ]
dflist=[]
for file in loglist :
    dftemp = pd.read_csv(file, 
                         names = ['name','filename', 'nsim', 'nfound', 'dcor', 'cor', 'invcor', 'eff98', 'eff5ns'],
                         header=None)
    dflist.append(dftemp)
    
df = pd.concat(dflist, ignore_index=True)
df['type'] = df.filename.apply(lambda x : x.split('/')[-1].split('_')[0][:-3])
df['tau'] = df.filename.apply(lambda x : int(x.split('/')[-1].split('_')[0][-3:]))
df['shortname'] = df.name + '-' +df.type + '-' + df.tau.astype(str)
df
Colors -> matplotlib named colors
# color dictionary for the bar plot
colordict = {'valerio'    : 'deepskyblue',
             'alessiaS'   : 'gold',
             'edoardo'    : 'mediumpurple', 
             'Silvia'     : 'aquamarine',
             'Magda'      : 'mediumseagreen',
             'Damiano'    : 'lightsteelblue',
             'Andrea'     : 'orangered',
             'Martino'    : 'dodgerblue',
             'Maria1'     : 'yellowgreen',
             'Maria2'     : 'olivedrab'
            }
def dobarplot(a, param='dcor', asc=True, select='poiss') :
    subdf = df[df['type']==select]
    labels = subdf.sort_values([param], ascending=asc).shortname.values
    idx = range(len(labels))
    values = subdf.sort_values([param], ascending=asc)[param].values
    colorlist = [colordict.get(l.split('-')[0], 'grey')  for l in labels]
    a.set_title(param+' '+select, fontsize=16)
    a.barh(idx,values, tick_label=labels, color=colorlist)
    maxw = 0
    for b in a.patches:
        if b.get_width() > maxw :
            maxw = b.get_width()
       
    for i,bar in enumerate(a.patches):
        a.text(max(bar.get_width()-0.01, maxw*0.15),bar.get_y()+0.01,f'{values[i]:.3f}', fontsize=9, ha='right', va='bottom')
fig, ax = plt.subplots(1,3,figsize=(20,12))
plt.subplots_adjust(wspace = 0.4)
dobarplot(ax[0], 'dcor', select='poiss')
dobarplot(ax[1], 'dcor', select='flat')
dobarplot(ax[2], 'dcor', select='expo')
plt.show()
fig.savefig('finalbars.pdf')