From: Whatagirl Klein on
Hello everybody,

I'm new here and I have some problems concerning contourf.

I want to plot circles with specified radius. This works well. But the colors are defined by the radius and that isn't what I want. I want to define the colors by a property which is defined in a vector of the same length as the radius.

There are 12 radius with 12 different properties. These properties are values between -3.5:0.5:2 and the radius is a vectore R = [20; 30; 50; 110; 210; 370; 660; 1180; 2110; 3750; 6670; 11870]. The Problem ist that the colors of the plot reflect the radius and so the colors for the small radius are very similara and you can't see the difference.

Thanks a lot for your help

Bye Christine

My code:

R = [20; 30; 50; 110; 210; 370; 660; 1180; 2110; 3750; 6670; 11870];
Mw = [-3.5; -3; -2.5; -2; -1.5; -1; -0.5; 0; 0.5; 1;1.5;2];
for z=30:30:150;
figure(5)
x = -max(R):20:max(R);
y = -max(R):20:max(R);
[X, Y] = meshgrid(x,y);
Z = sqrt(X.^2 + Y.^2);
[A,B]=contourf(X+100,Y+200,Z,R,'linecolor','w');
axis('equal')
colormap(jet)
set(gca,'ydir','reverse')
end
 | 
Pages: 1
Prev: graph allshortest paths
Next: feval error