I have a matlab script such as this:
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')
I have two contour plots on the same plot, one shown in red, the other shown in blue. The problem is that the legend doesn't show up in the red and blue colors. In an older version of matlab this worked just fine, but how are you supposed to define the legend in R2014b so that it has red contours next to 'test 1' and blue contours next to 'test 2'?
Someone else had a very similar question on mathcentral but it didn't get answered: http://www.mathworks.com/matlabcentral/answers/164210-how-does-the-contour-plot-with-r2014b-work.
Thanks!
clegendm? - Ratbert