Missing legend entries in plotyy

1 回表示 (過去 30 日間)
Niek Leemkuil
Niek Leemkuil 2022 年 4 月 22 日
回答済み: Adam Danz 2022 年 4 月 22 日
i'd like to plot multiple data lines in a plotyy graph. But it is not showing the correct lines
The TC is a variable. The grpah is plotting all variables but my legend shows only the amount of variables as 1 string.
How can this be solved?
n is the amount of TC graph i want to plot:
n=input('amount of plot TC : ');
figure(1)
T_pl=[T TC(:,1:n)];
ax=plotyy(t,T_pl,t,radiation);grid on
legend( 'Setpoint Temperature',...
'Measured Temperature',...
'Setpoint Radiation',...
'Measured Radiation',...
lgnd(1:n,:),...
'Location','SouthEastOutside')

回答 (1 件)

Adam Danz
Adam Danz 2022 年 4 月 22 日
Use yyaxis instead of plotyy.
Instead of using plotyy(x1,y1,x2,y2)
use
yyaxis left
plot(x1,y1)
yyaxis right
plot(x2,y2)
Then call legend.

カテゴリ

Help Center および File ExchangeTwo y-axis についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by