2
不同我有一个MATLAB脚本像这样:在R2014b Matlab的等高线图图例从以前的版本
x = linspace(-2*pi,2*pi);
y = linspace(0,4*pi);
[X,Y] = meshgrid(x,y);
Z = sin(X)+cos(Y);
Z1 = cos(.5*X) + sin(2*Y);
figure
[c h] = contour(X,Y,Z, '-r')
hold on
[c1 h2] = contour(X,Y,Z1, '-b')
legend('test1', 'test2')
我有同积2个等高线图,一个以红色显示,其他的以蓝色显示。问题在于图例不会以红色和蓝色显示。在老版本的matlab中,这工作得很好,但是你应该如何在R2014b中定义图例,以便它在'测试1'旁边具有红色轮廓并且在'测试2'旁边具有蓝色轮廓?
其他人在mathcentral上有一个非常类似的问题,但没有得到回答:http://www.mathworks.com/matlabcentral/answers/164210-how-does-the-contour-plot-with-r2014b-work。
谢谢!
有你看着['clegendm'](http://fr.mathworks.com/help/map/ref/ clegendm.html)? – Ratbert 2015-02-06 20:43:42