Labels on plot lines

조회 수: 6 (최근 30일)
Leandro Seguro
Leandro Seguro 2022년 3월 7일
편집: Matt J 2022년 3월 7일
Hello,
I'd like to overlay line titles on each line on the plot, using the corresponding titles as shown in the legend.
How could I do this?
Thank you.

채택된 답변

Matt J
Matt J 2022년 3월 7일
편집: Matt J 2022년 3월 7일
Using the text() command?
clear t
Vkts = [120,110,100,90,80,70,60,50];
Vms = Vkts/1.944;
Hdata=0:0.15:0.6;
figure(1)
hold on
for i=1:numel(Hdata)
H_m=Hdata(i);
eta = -((2*860*9.81)./(1.1549*Vms.^2*14.82))*((H_m)/(0.471*3));
eta_deg = eta*(180/pi);
plot(Vms,eta_deg)
t(i)=text( Vms(4),eta_deg(4),"H_m = " +H_m);
end
hold off
xlim([26 62])
ylim([-40 1])
grid on
grid minor
str={t.String};
leg=legend(str{:},'Location','Southeast');
  댓글 수: 1
Leandro Seguro
Leandro Seguro 2022년 3월 7일
That's perfect, thank you!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by