Subplot according to Real size
조회 수: 5 (최근 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)
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!