Although this is not an ideal solution, matplotlib has a built-in way to save restrictions, ticks, etc. two separate graphs in sync.
eg.
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 4 * np.pi, 100) y = np.cos(x) figures = [plt.figure() for _ in range(3)] ax1 = figures[0].add_subplot(111) axes = [ax1] + [fig.add_subplot(111, sharex=ax1, sharey=ax1) for fig in figures[1:]] for ax in axes: ax.plot(x, y, 'go-') ax1.set_xlabel('test') plt.show()
Please note that all 3 graphs will remain in sync when zooming, panning, etc.
Probably the best way to do this.
source share