Xlabels没有显示使用subplot2grid - matplotlib

时间:2015-05-22 17:36:30

标签: python-3.x pandas matplotlib subplot jupyter

我的问题代表matplotlib,更准确地说是subplot2grid:xlabels只是拒绝显示在2个第一个条形图上(跟随屏幕上限。)

xlabels refuse to show **

以下代码:

**

fig = plt.figure(figsize=(12,15), dpi=1600) 

fig.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)

ax1 = plt.subplot2grid((3,2),(0,0))
t_mois.sort('mois').plot(kind='bar', x='mois', y='count', legend=False, ax=ax1, alpha=alpha_bar_chart)
ax1.set_xlabel('plot 1 x-label')

ax2 = plt.subplot2grid((3,2),(0,1))
t_semaine.sort('jours_semaine').plot(kind='bar', x='jours_semaine', y='count', legend=False, ax=ax2, alpha=alpha_bar_chart)
plt.setp(ax2.get_xticklabels(), visible=True)
ax2.set_xlabel('plot 2 x-label')

ax3 = plt.subplot2grid((3,2),(1,0), colspan=2)
t_jours_mois.sort('jours_mois').plot(kind='bar', x='jours_mois', y='count', legend=False, ax=ax3)

ax4 = plt.subplot2grid((3,2),(2,0), colspan=2)
t_jour_annee.sort('jours_annee').plot(kind='bar', x='jours_annee', y='count', legend=False, ax=ax4)

plt.tight_layout()
plt.show()

我已经尝试了几件事(例如更改网格,手动设置,在图之间添加空格......)但没有成功。相比之下,当我在单独的网格或控制台中绘制它时,xlabels会自然地显示出来。

有什么猜测吗?

非常感谢

N-B:我正在使用Jupyter(最新版本的Ipython Notebook)和Python 3内核。

0 个答案:

没有答案