i got an error as Warning: Ignoring extra legend entries
3 次查看(过去 30 天)
显示 更早的评论
figure('name','flux vs current');
h1=plot(I1, flux1);
set(h1,'color','red','linewidth',3);
grid on;
hold all;
h2=plot(I2, flux2);
set(h2,'color','blue','linewidth',3);
grid on;
h3=plot(I3, flux3);
set(h3,'color','green','linewidth',3);
grid on;
legend([h1;h2;h3],'f1=30','f2=120','f3=400','fontsize',10);
title('flux vs current');
xlabel('current','fontsize',22);
ylabel('flux','fontsize',22);
how to overcome this. thanks in advance
0 个评论
采纳的回答
更多回答(1 个)
Azzi Abdelmalek
2014-8-25
close all
clc
[I1,I2,I3]=deal(1:10);
flux1=sin(l1)
flux2=cos(I2)
flux3=sin(I3).^2
figure('name','flux vs current');
h1=plot(I1, flux1);
set(h1,'color','red','linewidth',3);
grid on;
hold all;
h2=plot(I2, flux2);
set(h2,'color','blue','linewidth',3);
grid on;
h3=plot(I3, flux3);
set(h3,'color','green','linewidth',3);
grid on;
hleg=legend('f1=30','f2=120','f3=400');
set(hleg,'fontsize',14)
title('flux vs current');
xlabel('current','fontsize',22);
ylabel('flux','fontsize',22);
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!