I have a stack of four vertical subplots. How do I display the x axis label and tick labels below the third subplot (i.e., on top of the fourth one)? This does not work:
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(4)
fig.subplots_adjust( hspace=0.0) #I can't remove this. Not negotiable. :(
x = np.arange(0,10,0.1)
a = x + 1
b = np.sin(x)
c = 1.0/(1.0+x**2)
ax[0].plot( x, a )
ax[1].plot( x, b )
ax[2].plot( x, c )
for i in [0,1,2]:
ax[i].set_xlim( [-0.2, 10.2] )
ax[2].set_xlabel( "x axis label" )
ax[2].get_xaxis().set_visible(True)
ax[3].get_xaxis().set_visible(False)
plt.show()