필터 지우기
필터 지우기

How to Specify the Size of Rectangles in a figure?

조회 수: 4 (최근 30일)
Rightia Rollmann
Rightia Rollmann 2017년 2월 21일
편집: Rightia Rollmann 2017년 2월 21일
I have drawn 3 rectangles and put them in a struct as follows. It occupies the whole figure1 area. How to make them so small that just, for example, these rectangles just take one fifth of the figure1’s area?
hfig = figure;
for i = 1 : 3
W = 4;
X = i.* W;
Y = 0;
H = 8;
R = rectangle;
R.Position = [X Y W H];
G(i).r = R;
end

채택된 답변

Jan
Jan 2017년 2월 21일
The rectangle is a child of an axes object. The axes is fit to the included data automatically, if you do not specify its data limit.
hFig = figure;
hAxes = axes('NextPlot', 'add', 'XLim', [0, 20], 'YLim', [-1, 10]);
W = 4;
Y = 0;
H = 8;
for i = 1 : 3
X = i.* W;
R = rectangle;
R.Position = [X Y W H];
G(i).r = R;
end
  댓글 수: 1
Rightia Rollmann
Rightia Rollmann 2017년 2월 21일
편집: Rightia Rollmann 2017년 2월 21일
Thanks, but still one problem:
How can I define the struct G as the child for figure? Further information here.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by