필터 지우기
필터 지우기

How do I move the legend on my plot?

조회 수: 103 (최근 30일)
Josie
Josie 2014년 8월 1일
편집: Adam 2014년 8월 1일
I'd like to move the legend to the upper left corner of my plot. How do I do this?
M=linspace(0,0.1,500);
g=10;
for A=0.1:0.1:0.9
s=(A-0.5)*M*g-(A^2)/4;
theta=s./(2*M.*(A-0.5)^2+2*M+(A^2-A+1/3)/2);
N=((2*M-0.5*(A^2-A+1/6)).*theta-0.25*(A^2-A))/(A-0.5);
plot(M,N)
axis([0,0.1,-0.4,1])
hold all
end
legend('A=0.1','A=0.2','A=0.3','A=0.4','A=0.5','A=0.6','A=0.7','A=0.8','A=0.9')

답변 (1개)

Adam
Adam 2014년 8월 1일
편집: Adam 2014년 8월 1일
legend(...,'Location', 'location')
allows you to either specify the 'location' as one of a huge number of pre-defined positions e.g 'NorthWest', 'NorthWestOutside' or as a standard 1-by-4 position vector for precise manual positioning.
The pre-defined locations are included in a list on the help page for 'legend'

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by