import pandas as pd import seaborn as sns import matplotlib.pyplot as pl 导入数据 df = pd.read_excel(r'E:\XY\hhly1\clean\hhly1\Alphy/alphy.xlsx') 设置风格 sns.set_theme(style='ticks',font='Times New Roman') 绘制多子图 g=sns.FacetGrid(df,col='index',col_wrap=2,sharey=None) 追加子图图片内容 g.map_dataframe(sns.boxplot,y='alpha',x='index',hue = "index",saturation=1,palette="light:#5A9") g.map_dataframe(sns.stripplot,y='alpha',x='index',hue = "index") plt.savefig(r'E:\XY\hhly1\clean\hhly1\Alphy/alpha1.png',dpi=300,) plt.show() import pandas as pd import seaborn as sns import matplotlib.pyplot as plt df1 = pd.read_excel(r'E:\XY\hhly1\clean\hhly1\Alphy/coverage.xlsx') plt.figure(dpi=300,figsize=(17,4)) # plt.rc('font',family='Times New Roman') sns.set_theme(style='ticks',font='Times New Roman') sns.boxplot(x = 'goods_coverage',data = df1,saturation=1,palette="light:#5A9") sns.stripplot(x ='goods_coverage', data=df1,color='black') plt.savefig(r'E:\XY\hhly1\clean\hhly1\Alphy/coverage1.png',dpi=300,) plt.show()