//  [python]
def transition_scores(transition_scores_raw, model_names=None, model_label = 'Model', raw=False, custom_colors = None, height=4, aspect=1):

    if model_names == None:

        if raw == False:
            
            transition_scores_ = pd.DataFrame({" ": [t[0] + r'$\rightarrow$' + t[1] for t in transition_scores_raw.keys()], "CBDir score": transition_scores_raw.values()})
            
            ax = sns.factorplot(
                data=transition_scores_, 
                y=" ", x="CBDir score", kind='bar', color='k',
                ci="sd", alpha=.6, size=height, aspect=aspect, orient='h'
            ) #color='k', 
            #ax.set_xticklabels(rotation=90)
            ax.set(xlim=(-1, 1))
        
            #ax.fig.suptitle('Model c)')
            return ax

        else:
            
            score = []
            transition = []
            embedding=[]
            
            for key in transition_scores_raw.keys():
                for item in transition_scores_raw[key]:
                    score.append(item)
                    transition.append(key[0] + r'$\rightarrow$' + key[1])
            
            transition_scores_ = pd.DataFrame({'CBDir score':score, ' ':transition})
            
            PROPS = {
            'boxprops':{'facecolor':'darkgrey', 'edgecolor':'black'},
            'medianprops':{'color':'black'},
            'whiskerprops':{'color':'black'},
                'capprops':{'color':'black'}
            }
            
            ax = sns.factorplot(
                data=transition_scores_, 
                y=' ', x="CBDir score", kind='box', 
                size=height, aspect=aspect, orient='h', fliersize=0, **PROPS, showmeans=True, notch=True,
                            meanprops={"marker":"o",
                       "markerfacecolor":"white", 
                       "markeredgecolor":"black",
                      "markersize":"8"}
            ) #color='k', 
            #ax.set_xticklabels(rotation=90)
            ax.set(xlim=(-1, 1))
            return ax
        
    else:

        if raw == False:
            
            transition_scores_ = [pd.DataFrame({" ": [t[0] + r'$\rightarrow$' + t[1] for t in tscores.keys()], "CBDir score": tscores.values()}) for tscores in transition_scores_raw]
            
            for i in range(len(model_names)):
                transition_scores_[i][model_label] = model_names[i]
                
            transition_scores_ = pd.DataFrame(pd.concat(transition_scores_, axis=0))
            
            ax = sns.factorplot(
                data=transition_scores_, 
                y=" ", x="CBDir score", kind='bar', hue=model_label,
                ci="sd", alpha=1, size=height, aspect=aspect, orient='h', palette = 'Set1', showmeans=True,
                            meanprops={"marker":"o",
                       "markerfacecolor":"white", 
                       "markeredgecolor":"black",
                      "markersize":"8"}
            )
            ax.set(xlim=(-1, 1))
            
            return ax    

        else:

            score = []
            transition = []
            embedding=[]
            
            for items, name in zip(transition_scores_raw, model_names):
                for key in items.keys():
                    for item in items[key]:
                        score.append(item)
                        transition.append(key[0] + r'$\rightarrow$' + key[1])
                        embedding.append(name)

            transition_scores_ = pd.DataFrame({'CBDir score':score, ' ':transition, model_label:embedding})
            
            if np.any(custom_colors != None):
                ax = sns.factorplot(
                    data=transition_scores_, 
                    y=' ', x="CBDir score", kind='box', hue=model_label,
                    size=height, aspect=aspect, orient='h', palette = custom_colors, fliersize=0
                ) 
            else:
                ax = sns.factorplot(
                    data=transition_scores_, 
                    y=' ', x="CBDir score", kind='box', hue=model_label,
                    size=height, aspect=aspect, orient='h', palette = 'Set1', fliersize=0, showmeans=True,
                            meanprops={"marker":"o",
                       "markerfacecolor":"white", 
                       "markeredgecolor":"black",
                      "markersize":"8"}
                )
            ax.set(xlim=(-1, 1))
            
            return ax