I took a look to several discussions on the site and I can't find what I want. I want to set a common xlabel to 2 subplots on the same line like this :
I tried set_xlabel(), text(), but for the first it didn't work, and for the second I can't put the text at the bottom center.
And I would like to optimize the code, if someone knows how.
My code :
plt.subplot(121)
plt.barh(range(1, len(y)+1), y)
plt.yticks([i+1.5 for i in range(7)], range(7))
plt.xlim(0, xmax)
plt.ylabel("Y label")
plt.subplot(122)
plt.barh(range(1, len(y2)+1), y2, color="r")
plt.yticks([i+1.5 for i in range(7)], range(7))
plt.xlim(0, xmax)