Still no answers ... Is there a better way to put two legends for different axes on a chart as described above?
Problem with 2014b for replotting with multiple legends in plotyy chart
1 回表示 (過去 30 日間)
古いコメントを表示
I am trying to update a chart created with plotyy that uses two legend boxes for the two y-axes. I can create the chart, but when I replot the chart (normally with new data or with a different number of traces), I get the following error:
Error using legend (line 120)
'LayoutManager' is already defined as a property.
This code replicates the error (note: this worked fine in 2013a, but fails in 2014b)
% setup and initial chart
x = 1:10;
y1 = [1:10;0:9];
y2 = [20:-2:2];
figure;
[AX, H1, H2] = plotyy(x,y1,x,y2);
legend(AX(1), 'y1', 'Location', 'NorthWest');
legend(AX(2), 'y2', 'Location', 'NorthEast');
% replot using the same commands - this first part works as expected
[AX, H1, H2] = plotyy(x,y1,x,y2);
legend(AX(1), 'y1', 'Location', 'NorthWest');
% This last line fails with the error noted above
legend(AX(2), 'y2', 'Location', 'NorthEast');
Any thoughts?
採用された回答
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Two y-axis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!