0

I created a figure with 8 subplots of timeseries objects, because I wanted to have an overview of the data.

Is there an option which gives me the following possibility:

If I zoom into one subplot (for example: just the range from 5 to 10 on the x-axis is now visible), than all other plots will automatically zoom in (such that the range from 5 to 10 on the x-axis is now just visible for all other subplots) too??

d4rty
  • 3,970
  • 5
  • 34
  • 73

1 Answers1

0

For linking both the x and y axes, you should use the command linkaxes. It takes as input a vector of handles to axis objects you want to link together, and additional options if desired.

Example:

for k = 1:4
    ah(k) = subplot(2,2,k);
    plot(1:10, rand(1,10));
end
linkaxes(ah);

After this, if you apply e.g. zooming on any of the subfigures, the x and y limits of the other axes will change as well.

If you want to link only, say, the x axis, use instead:

linkaxes(ah,'x');
mikkola
  • 3,376
  • 1
  • 19
  • 41