How to shrink each figure inside a subplot ?

조회 수: 3 (최근 30일)
hello_world
hello_world 2015년 4월 1일
편집: hello_world 2015년 4월 1일
Hello Friends,
Suppose I have the following example:
figure
for ii = 1:5
subplot(1, 5, ii)
plot(ii, sin(ii));
end
This creates a figure containing 1x5 subfigures. Each of these subfigures has its own horizontal/vertical lengths which I want to shrink/increase.
Please advise!

채택된 답변

Vinod Sudheesh
Vinod Sudheesh 2015년 4월 1일
You could achieve this by modifying the "Position" (or "OuterPosition") property for each of the five individual "axes".
For example to reduce the "Width" and "Height" for each of the five individual axes to 50%, please see the code snippet below:
figure
for ii = 1:5
subplot(1, 5, ii)
plot(ii, sin(ii));
tmp=get(gca,'position');
set(gca,'position',[tmp(1) tmp(2) 0.5*tmp(3) 0.5*tmp(4)])
end
For more information on "axes properties", please refer to the following documentation page:
  댓글 수: 1
hello_world
hello_world 2015년 4월 1일
편집: hello_world 2015년 4월 1일
Thank you Vinod. It was precisely what I needed. Can you or someone else also help me with my other question I posted here, but no one is answering it:

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by