How can I add legend to graph with each loop for ezplot?
Afficher commentaires plus anciens
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
Réponses (1)
Walter Roberson
le 16 Sep 2016
%%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 commentaires
Akshay Kumar
le 18 Sep 2016
Walter Roberson
le 18 Sep 2016
You could also use
leg_entries{i} = sprintf('b = %s', char(b(i)));
Catégories
En savoir plus sur Legend dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!