Why does the legend of a contour plot in MATLAB 7.0 (R14) not look the way it did in MATLAB 6.5 (R13)?
4 ビュー (過去 30 日間)
古いコメントを表示
If you run the code below in MATLAB 6.5 (R13) and again in MATLAB 7.0 (R14), you will see the legends in those two plots are different.
Under MATLAB 6.5, each label in 'legend' is associated with a different fill color in the contour plot. Under MATLAB 7.0, only one label is shown, and the sample face color includes all the colors in the plot.
[C,h] = contourf(peaks(20),10);
legend('A', 'B', 'C')
When I try to execute this code, I receive the following error:
Warning: Ignoring extra legend entries.
採用された回答
MathWorks Support Team
2010 年 1 月 22 日
The way that plot legends are created in MATLAB 7.0 (R14) is different from how they were created in MATLAB 6.5 (R13).
To work around this issue, include 'v6' in the CONTOURF command. This causes the legend to be the same as it was in MATLAB 6.5.
[C,h] = contourf('v6',peaks(20),10);
legend('A', 'B', 'C')
See "Plot Objects and Backward Compatibility" in the Handle Graphics documentation for more information.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Contour Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!