Multiple legend location in figure

1 回表示 (過去 30 日間)
Subhamoy Saha
Subhamoy Saha 2019 年 1 月 12 日
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 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by