plotyy and legend display
10 ビュー (過去 30 日間)
古いコメントを表示
hi everyone, i'm trying to plot multiple graphs on a plot using multiple y-axes
i'm using the plotyy function and everything is going smoothly except for when i want to call the legend.
right now, I have to call legend twice (once for the series on the primary y axis, and once for the series plotted on the secondary y-axis) so there are 2 legend boxes on the plot.
is there a way to show just one legend box with all the series displayed in it from both the primary and secondary axes?
0 件のコメント
回答 (1 件)
Thomas
2012 年 5 月 9 日
If you are calling the legend like this now..
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot','plot');
legend(H1,'y1');
legend(H2,'y2');
you could try
legend([H1;H2],'y1','y2');
参考
カテゴリ
Help Center および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!