Question: I have multiple subplots in one figure. The X axis of each plot is the same variable (time). The Y axis on each plot is different (both in what it represents and the magnitude of the data).

I would like a way to zoom in on the time scale on all plots simultaneously. Ideally by using the rectangle zoom tool on one of the plots, and having the other plots change their X limits accordingly. The Y limits should remained unchanged for all of this. Auto fitting the data to fill the plot in the Y direction is acceptable.

(This question is almost identical to Stack Overflow question one *[Matplotlib/Pyplot: How to zoom subplots together?](https://stackoverflow.com/questions/4200586/matplotlib-pyplot-how-to-zoom-subplots-together)* (except for [MATLAB](http://en.wikipedia.org/wiki/MATLAB)))

Answer: 
Use the built-in [linkaxes](http://www.mathworks.com/help/techdoc/ref/linkaxes.html) function as follows:

```
linkaxes([hAxes1,hAxes2,hAxes3], 'x');

```

For more advanced linking (not just the x or y axes), use the built-in [linkprop](http://www.mathworks.com/help/techdoc/ref/linkprop.html) function
To link a pair of figures with linkaxes use:

```
figure;imagesc(data1);
f1h=findobj(gcf,,’type’,’axes’)
figure;imagesc(data2);
f2h=findobj(gcf,,’type’,’axes’)
linkaxes([f1h,f2h],’xy’)

```