필터 지우기
필터 지우기

Positioning Axes using arrays

조회 수: 2 (최근 30일)
HC98
HC98 2023년 5월 9일
답변: Steven Lord 2023년 5월 9일
I have this simple code
% create smaller axes in top right, and plot on it
axes('Position', [.32 .22 .25 .15])
box on
plot(x, data, 'k')
xlim([-150 50])
% ylim([0.1 inf])
% xlabel('$x$')
% ylabel('$Field$')
% box off
and I want to better understand how the positional arguments, i.e. how
axes('Position', [.32 .22 .25 .15])
works. Any rescources to help understand how these positional arguments work? TIA as always.

답변 (2개)

Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023년 5월 9일
편집: Antoni Garcia-Herreros 2023년 5월 9일
% axes('Position', [x y u v])
The bottom left corner of the axes is positioned at (x,y). The bottom left of your figure is the (0,0).
(u,v) are the width and height of your axes. Width and height are normalized quantities, therefore a value of 1 indicates the whole length of your figure
figure(1)
axes('Position',[.32 .22 .25 .15])
figure(2)
axes('Position',[.72 .22 .25 .15])
title('Changing X')
figure(3)
axes('Position',[.32 .72 .25 .15])
title('Changing Y')
figure(4)
axes('Position',[.32 .42 .55 .55])
title('Changing size')

Steven Lord
Steven Lord 2023년 5월 9일
Position is one of the properties of an axes object. In general for the core graphics objects the documentation pages list and explain the properties those objects have. The section on the Position property includes some text, some pictures, and a link to a page that explains the position-related properties in more detail.
The graphics functions can accept a list of name-value arguments that represent a list of properties and their values to be set once the object is created (or that controls how the object is created.)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by