dimanche 24 mai 2020

Statannot: box_pairs contains an invalid box pair?

I'm trying to perform a Wilcoxon tests between pairs of boxplots in the figure below using "statannot". I am using the following piece of code:

df = pd.read_pickle('metrics_total.pkl')
plt.figure(1)
ax = sns.boxplot(x="Location", y="value", hue="Input approach", data=df, showmeans=True, meanprops = {"marker": "x", "markerfacecolor": "white", "markeredgecolor": "white"})
ax.set_ylim([0, 1])
ax.set_ylabel('Metric value', fontsize=15)
ax.set_xlabel('Metric', fontsize=15)
add_stat_annotation(ax, data=df, x="Location", y="value", hue="Input approach",
                                    box_pairs=[('DSC', 'Model 1'), ('DSC', 'Model 2')],
                                    test='Wilcoxon', text_format='star',
                                    loc='outside', verbose=2)

However, I am getting the follwing error:

ValueError: box_pairs contains an invalid box pair.

I am following an example on the document page of statannot so I don't know what I am doing wrong?

enter image description here

Aucun commentaire:

Enregistrer un commentaire