Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB - How to zoom subplots together?

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? (except for MATLAB))

like image 904
Miebster Avatar asked Feb 16 '11 22:02

Miebster


People also ask

How do you zoom subplots together?

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.

How do you add a zoom plot in Matlab?

When zoom mode is on, to zoom in, position your cursor where you want the center of the axes to be and either scroll up or click. To zoom out, either scroll down or hold Shift and click. Each click zooms in or out by a factor of 2. To zoom into a rectangular region, click and drag.

How do I make subplots different sizes Matlab?

It's possible to make subplots of different sizes by specifying a multiple-element vector for the grid position argument p in the syntax subplot(m,n,p) . Show activity on this post. You can add 4 axeses to the figure, and set the position of each axes: I = imread('cameraman.

How do you link axes in Matlab?

You can link any number of Axes objects. For example, linkaxes([ax1 ax2 ax3]) links ax1 , ax2 , and ax3 . Separate calls to linkaxes([ax1 ax2]) and linkaxes([ax2 ax3]) cancels the link between ax1 and ax2 .


1 Answers

Use the built-in linkaxes function as follows:

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

For more advanced linking (not just the x or y axes), use the built-in linkprop function

like image 110
Yair Altman Avatar answered Sep 26 '22 01:09

Yair Altman