From: John H. <jdh...@ac...> - 2004-06-16 03:05:00
|
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes: Flavio> how do I force the second plot to have the same limits on Flavio> the x axis as the first? The short answer is you can't. You could write some helper functions or classes to force axes to behave similarly. The example code below will call any function on all the axes. Use with caution! class CallAll: def __init__(self, seq, name): self.seq = seq self.name = name def __call__(self, *args, **kwargs): for a in self.seq: func = getattr(a, self.name) func(*args, **kwargs) class SharedAxes: def __init__(self, axlist): self.axlist = axlist def __getattr__(self, key): return CallAll(self.axlist, key) ax1 = subplot(211) plot(blah, blah) ax2 = subplot(212) plot(blah, blah) shared = SharedAxes((ax1, ax2)) shared.set_xlim(0,2) |