|
Thanks for that, I'm closer to get what a wanted but:
map =
0 0 0.5608
0 0.2510 1.0000
0 1.0000 1.0000
1.0000 1.0000 1.0000
1.0000 0.3765 0
1.0000 0 0
0.7843 0 0
creating my 7 colors (range)
then colormap(map)
...[C,h] = contourf(long, time,'my variable');% my variable is 540x128
Cld = get(h, 'Children');
for j=1:length(Cld)
if strcmp(get(Cld(j),'Type'),'patch')
Iso=get(Cld(j),'CData');
if Iso > 12.5
set(Cld(j),'cdata',5);
elseif Iso >7.5&& Iso <= 12.5
set(Cld(j),'cdata',4);
elseif Iso >2.5&& Iso <= 7.5
set(Cld(j),'cdata',3);
elseif Iso >= -2.5 && Iso <= 2.5
set(Cld(j),'cdata',0);
elseif Iso < -2.5 && Iso >= -7.5
set(Cld(j),'cdata',1);
elseif Iso < -7.5 && Iso >= -12.5
set(Cld(j),'cdata',2);
elseif Iso < -12.5
end
end
end
..what I dont get is where you assign the color, I mean when doing set(Cld(j),'cdata', #).
I hope you understand my sort of explanation
cheers and thank you again
Ernesto
"Jerome Briot" <dut@matlab.fr> wrote in message <h9d2gd$76h$1@fred.mathworks.com>...
> > As far as I know, you can only change the contour fill colour afterwards, not specify it while plotting.
> > ...
> > Sebastiaan
>
> The same solution but with a colormap :
>
> figure
>
> map = [1 0 0
> 0 1 0
> 0 0 1
> 0 1 1];
>
> colormap(map);
>
> [C,h] = contourf(peaks(20));
> Cld = get(h, 'Children');
> for j=1:length(Cld)
> if strcmp(get(Cld(j), 'Type'), 'patch')
> Iso = get(Cld(j), 'CData');
> if Iso<-5
> set(Cld(j), 'cdata', 0);
> elseif Iso>=-5 && Iso<0
> set(Cld(j), 'cdata', 1);
> elseif Iso>=0 && Iso<5
> set(Cld(j), 'cdata', 2);
> else
> set(Cld(j), 'cdata', 3);
> end
> end
> end
>
> Jerome
|