Multiple legend location in figure
古いコメントを表示
Hi, I have a code similar to below where I want to put the legends at different location. This code is running well in 2014b but not in 2017a. Please help me out. Also tried with 'yyaxis' command but no luck.
a=[-360:1:360];
x=(2*pi/180).*a;
y1=sin(x);
y2=cos(x);
y3=sin(x).*cos(x);
figure
[ax,h1,h2]=plotyy(a,y1,a,y3);
h3=line(a,y2,'Color','r','LineWidth',1.5,'Parent',ax(1));
h4=line(a,zeros(1,721),'Color','k');
set(ax,'XLim',[-360 360]);
set(ax(1),'ylim',[-1.5 1.5])
set(ax(2),'ylim',[-1 1])
legend(ax(1),'sin','cos','Location','NorthEast')
legend(ax(2),'sin * cos','Location','NorthWest')
The above is my code.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!