Subplot according to Real size

4 次查看(过去 30 天)
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
a=rand(60,120)
b=rand(600,240)
figure
subplot 121
imagesc(a)
axis equal
axis([0 60 0 120])
subplot 122
imagesc(b)

采纳的回答

Cris LaPierre
Cris LaPierre 2019-3-10
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.
a=rand(60,120)
b=rand(600,240)
% Create a figure window and set the units to normalized (0=bottom/left, 1=right/top)
h=figure('Units','normalized')
% 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)])
imagesc(ax1,a)
axis equal
axis tight
% Place second axis
ax2 = axes('Position',[xPos(4) yPos(2) xPos(3) yPos(11)])
imagesc(ax2,b)
axis equal
axis tight

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by