How can I add legend to graph with each loop for ezplot?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I am plotting blending function of bezier curve, in which number of blending curve depends on the number of control points taken.
Now, my problem is I want to add legend for each graph(ezplot) which is plotted by running loop?
Please! help me.
Code is:
%%Plotting of blending curve
for i=1:length(b)
ezplot(b(i),[min(u),max(u)])
hold on
end
댓글 수: 0
답변 (1개)
Walter Roberson
2016년 9월 16일
%%Plotting of blending curve
for i=1:length(b)
h(i) = ezplot(b(i),[min(u),max(u)]);
leg_entries{i} = sprintf('b = %g', b(i));
hold on
end
legend(h, leg_entries)
댓글 수: 2
Walter Roberson
2016년 9월 18일
You could also use
leg_entries{i} = sprintf('b = %s', char(b(i)));
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!