Question
I have a figure which has four subplots in it. The axes of the subplots are square when plotted. However when the figure is maximized, the subplots are no longer square. An example is provided below: figureHandle = figure; subplot(2,2,1), plot(exp(1:100)) subplot(2,2,2), plot(sin(0:pi/100:4*pi)) subplot(2,2,3), plot(log(0:30)) subplot(2,2,4), plot(1:40)
Expert Answer
Prashant Kumar
PhD Expert
Answered Aug 24, 2026
This is an expected behavior. By default, the stretch-to-fill behavior for axes is enabled. By extracting the axes handles of all subplots and setting them to square, the desired behavior can be achieved.
An example is provided below:
% Extract axes handles of all subplots from the figure axesHandles = findobj(get(figureHandle,'Children'), 'flat','Type','axes'); % Set the axis property to square axis(axesHandles,'square')
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →