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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.
Respuesta aceptada
MathWorks Support Team
el 22 de En. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Contour Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!