Zoom on multible figure at the same time

12 views (last 30 days)
Steen
Steen on 30 Nov 2023
Answered: Pratyush Swain on 11 Dec 2023
How to zoom in on all figure´s at the same time

Answers (1)

Pratyush Swain
Pratyush Swain on 11 Dec 2023
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.

Categories

Find more on Data Exploration in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!