Zoom on multible figure at the same time

12 次查看(过去 30 天)
How to zoom in on all figure´s at the same time

回答(1 个)

Pratyush Swain
Pratyush Swain 2023-12-11
Hi Steen,
I understand you want to zoom in on all figures at the same time. For this purpose, we have to link the axes of all the figures together and set common axes limits .
Please follow the example implementation for the same.
% Create the first figure and plot in it
fig1 = figure;
plot(1:10, rand(1,10)); % Example plot
ax1 = gca; % Get the axes of the first figure
% Create the second figure and plot in it
fig2 = figure;
plot(1:10, rand(1,10)); % Example plot
ax2 = gca; % Get the axes of the second figure
%Create the third figure and plot in it
fig3 = figure;
plot(1:10, rand(1,10)); % Example plot
ax3 = gca; % Get the axes of the third figure
% Create the fourth figure and plot in it
fig4 = figure;
plot(1:10, rand(1,10)); % Example plot
ax4 = gca; % Get the axes of the fourth figure
linkaxes([ax1, ax2 , ax3, ax4], 'xy'); % Link the x and y axes of all the axes
% Set common axes limits
xlim(ax1, [1,10]); % Set the x-axis limits
ylim(ax1, [0, 1]); % Set the y-axis limits
On replicating the example above on matlab, you will be able to zoom in all figures simultaneously.
For more information, please refer to documentation of 'linkaxes' function:
Hope this helps.

类别

Help CenterFile Exchange 中查找有关 Data Exploration 的更多信息

标签

产品


版本

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by