7

Here is my question. I know there is a simple way to link the axis of different plot if they are subplots in the same figure this way :

import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(211)
ax2 = fig.add_subplot(212, sharex=ax1)

But I wonder if there is a way to do the same link (when zooming on figure 1, I get the same zoom on figure 2 on one particular axis) when defining 2 different Figures (I want those graph to appear far from each other so I guess that I can't put them in the same Figure...)

Thanks a lot !

Jdawleer
  • 165
  • 3
  • 9
  • http://stackoverflow.com/questions/14503423/how-to-enable-disable-easily-shared-axis-using-matplotlib follow on question – tacaswell Jan 24 '13 at 15:10
  • on stackoverflow you should accept the answer (and maybe upvote it), if it answers your question. – bmu Jan 24 '13 at 19:31

1 Answers1

11

You simply do the same thing, but with a different figure.

import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(111)
fig2 = plt.figure()
ax2 = fig2.add_subplot(111, sharex=ax1)
tacaswell
  • 84,579
  • 22
  • 210
  • 199