필터 지우기
필터 지우기

Add a legend in plotting

조회 수: 1 (최근 30일)
Skydriver
Skydriver 2017년 12월 6일
답변: Skydriver 2017년 12월 6일
I want to add a legend in my plotting, in the explanation I want to add some kind of text 500 years, 1000 years, 2500 years and 5000 years.
My code is:
for i=1:length(Tm2)
plot(Tm1(:,1),(SA10(:,1)),'r');
hold on
plot(Tm1(:,1),(SA5(:,1)),'b');
hold on
plot(Tm1(:,1),(SA2(:,1)),'g');
hold on
plot(Tm1(:,1),(SA1(:,1)),'m');
hold on
title UniformHazardSpectra50Year
xlabel('time');
ylabel('Acceleration');
legend(500,1000,2500,5000);
end
Is there anybody can help me, why it doesn't works. The result is weird.

답변 (2개)

Walter Roberson
Walter Roberson 2017년 12월 6일
legend('500','1000','2500','5000');
  댓글 수: 1
Skydriver
Skydriver 2017년 12월 6일
Okay thanks, It works.

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


Skydriver
Skydriver 2017년 12월 6일
This is my plotting :)

카테고리

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