stripplot

多数の点を重なりを少なくして表示することで,データの分布を図示する。violinplotやboxplotはデータの分布の特徴を示す図であるのに対して,stripplotはデータ自体を示す。下の例にあるようにviolinpotと重ねて示すこともできる。また,matplotlib.pyplot.plotと同時に使うこともできる。
A striplot shows the data itself, whereas violinplot and boxplot show the characteristics of the data distribution. As shown in the example below, it can be superimposed on violinpot. It can also be used with matplotlib.pyplot.plot.
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])]