Xlabels not showing with subplot2grid - matplotlib

My problem is with matplotlib and more precisely with subplot2grid: the xlabels just refuse to be displayed on the first two chart bars (after the screen is closed).

xlabels refuse to show **

code below:

**

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()

      

I have already tried several things (like changing grids, setting them manually, adding spaces between graphs ...) with no success. In contrast, when I draw it in a separate grid or in the console, the xlabels appear naturally.

Any guess?

Many thanks

NB: I am using Jupyter (latest Ipython Notebook) with Python 3 core.

+3


source to share





All Articles