How share x axis of two subplots after they are created?
问题 I\'m trying to share two subplots axis, but I need to share x axis after the figure was created. So, for instance, I create this figure: import numpy as np import matplotlib.pyplot as plt t= np.arange(1000)/100. x = np.sin(2*np.pi*10*t) y = np.cos(2*np.pi*10*t) fig=plt.figure() ax1 = plt.subplot(211) plt.plot(t,x) ax2 = plt.subplot(212) plt.plot(t,y) # some code to share both x axis plt.show() Instead of the comment I would insert some code to share both x axis. I didn\'t find any clue how i