Subplot according to Real size

17 views (last 30 days)
MSP on 10 Mar 2019
Answered: Cris LaPierre on 10 Mar 2019
Greeetings people,
I am having an issue regarding plotting according to the real size.I am trying to explain according to this code .What I want is use subplot to plot according to the real size, which is like the 'b' should have 10 times the size of 'a' vertically and 2 times of 'a' horizontally.
Thanks in advance
subplot 121
axis equal
axis([0 60 0 120])
subplot 122

Accepted Answer

Cris LaPierre
Cris LaPierre on 10 Mar 2019
There is no good way to do what you want with subplot. Even if you merge multiple plots, there is no control over the size. You probably need to create the axes manually to have fine control over their size. Here's how I might do it.
% Create a figure window and set the units to normalized (0=bottom/left, 1=right/top)
% Divide the figure window into a grid.
% Plot(a) will be between x(2) and x(3), y(11) and y(12)
% Plot(b) will be between x(4) and x(6) - it's twice as wide, y(2) and y(12)
xPos = linspace(0,1,7);
yPos = linspace(0,1,13);
% Place first axis
ax1 = axes('Position',[xPos(2) yPos(11) xPos(2) yPos(2)])
axis equal
axis tight
% Place second axis
ax2 = axes('Position',[xPos(4) yPos(2) xPos(3) yPos(11)])
axis equal
axis tight

More Answers (0)

Community Treasure Hunt

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

Start Hunting!