import pstatsimport seaborn as snsimport numpy as npimport pandas as pdfrom matplotlib import pyplot as plt
y_list=[np.random.randn(100),np.random.randn(110),np.random.randn(120)]xname=[1,3,4]
y_1d_list=[]x_1d_list=[]for ind,y in enumerate(y_list): y_1d_list+=list(y) x_1d_list+=[xname[ind]]*len(y)
df=pd.DataFrame({'x':x_1d_list, 'y':y_1d_list})plt.ion()plt.clf()plt.subplot(1,2,1)sns.violinplot(df,x='x',y='y',alpha=0.25)sns.stripplot(df,x='x',y='y',alpha=0.8,color='black')plt.subplot(1,2,2)sns.stripplot(df,x='x',y='y',native_scale=True)plt.plot([2,2,2,2,2,2],[-3,-2,-1,1,2,3],'o')
#def stripplot_xy(x,y,xname,yname):# x=[xname[0]*len(y[0]),xname[1]*len(y[1]),xname[2]*len(y[2])]