for idx, feature in enumerate(feature_names): ax = sns.boxplot(x="Feature", hue="Group", y="Value", data = df_long[df_long.Feature == feature], linewidth=2, showmeans=True, meanprops={"marker":"*","markerfacecolor":"white", "markeredgecolor":"black"}, ax=axes[idx]) #* tick params axes[idx].set_xticklabels([str(feature)], rotation=0) axes[idx].set(xlabel=None) axes[idx].set(ylabel=None) axes[idx].grid(alpha=0.5) axes[idx].legend(loc="lower right", prop={'size': 11}) #*set edge color = black for b in range(len(ax.artists)): ax.artists[b].set_edgecolor('black') ax.artists[b].set_alpha(0.8) #* statistical tests x1, x2 = -0.20, 0.20 y, h, col = df_long[df_long.Feature == feature]["Value"].max()+1, 2, 'k' axes[idx].plot([x1, x1, x2, x2], [y, y+h, y+h, y], lw=1.5, c=col) axes[idx].text((x1+x2)*.5, y+h, "statistically significant", ha='center', va='bottom', color=col)