There is a simple example. The task is to build graphs in such a way that the x-axes have their single scale. Y-axis, respectively, too.

!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt x = np.arange(-10, 10.01, 0.01) y=np.arange(-5, 5.01, 0.01) #subplot 1 plt.subplot(211) plt.plot(x, np.sin(x)) plt.title(r'$\sin(x)$') plt.grid(True) #subplot 2 plt.subplot(212) #plt.plot(x, np.cos(x), 'g') plt.plot(y, np.cos(y), 'g') plt.axis('equal') plt.grid(True) plt.title(r'$\cos(y)$') plt.show() 

    1 answer 1

    To make the axes the same, you can use the sharex and sharey parameters when creating subplot .

     import numpy as np import matplotlib.pyplot as plt x = np.arange(-10, 10.01, 0.01) y = np.arange(-5, 5.01, 0.01) # subplot 1 ax = plt.subplot(211) plt.plot(x, np.sin(x)) plt.title(r'$\sin(x)$') plt.grid(True) # subplot 2 plt.subplot(212, sharex=ax, sharey=ax) plt.plot(y, np.cos(y), 'g') plt.grid(True) plt.title(r'$\cos(y)$') plt.show()