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 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
MathWorks Support Team
am 22 Jan. 2010
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Contour Plots finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!