I have a plot of 3 groups of 3 violins (so 9 violin plots) on the same axis and I want to label the groups, here is my attempt:
ax = plt.violinplot([method1[:,0].flatten(),method2[:,0].flatten(),method3[:,0].flatten()],positions= [1,2,3],showmeans=True,showmedians=False)
ax = plt.violinplot([method1[:,1].flatten(),method2[:,1].flatten(),method3[:,1].flatten()],positions=[5,6,7],showmeans=True,showmedians=False)
ax = plt.violinplot([method1[:,2].flatten(),method2[:,2].flatten(),method3[:,2].flatten()],positions=[9,10,11],showmeans=True,showmedians=False)
#positions = (([1,2,3],[5,6,7],[9,10,11]))
#labels = ( "method 1", "method 2","method 3")
#plt.xticks(positions = [2,6,10], labels)
ax.set_xticklabels(['method 1','method 2','method 3'])
ax.set_xticks([2,6,10])
I get the violin plots as intended but I can't figure out how to add the labels correctly. I get the error:
module 'matplotlib.pyplot' has no attribute 'set_xticklabels'