我正在使用matplotlib子图并排创建两个图。 这是我正在使用的代码
fig,(ax0,ax1) = py.subplots(nrows=1,ncols=2,sharey=True,figsize=(16,6))
fig.suptitle('Trips percentage per daira (for the top 10 dairas)',size = 16)
py.xticks(rotation = 90)
ax = sns.barplot(x = df.p_daira.value_counts().nlargest(10).index,y = df.p_daira.value_counts().nlargest(10) / df.shape[0] * 100,ax = ax0)
ax.set(xlabel='Pickup Daira',ylabel='Trips percentage')
ax.set_xticks(rotation=90)
#py.xticks(rotation=90)
ax = sns.barplot(x = df.d_daira.value_counts().nlargest(10).index,y = df.d_daira.value_counts().nlargest(10)/df.shape[0] * 100,ax = ax1)
ax.set(xlabel='Dropoff Daira',ylabel='Trips percentage')
py.show()
这是我得到的结果: Image
即使我将x_ticks旋转设置为90度,它也仅适用于第二个绘图!
有没有办法解决这个问题?