Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: coloring contour plot
Replies: 6   Last Post: Aug 10, 2009 5:55 PM

 Messages: [ Previous | Next ]
 Amin Bashi Posts: 10 Registered: 11/23/07
Re: coloring contour plot
Posted: Aug 10, 2009 8:44 AM

Bahari
try this, userdata value is value of isolines of matrix Z
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[X,Y] = meshgrid(-2:.2:2,-2:.2:3);
Z = X.*exp(-X.^2-Y.^2);
[C,h] = contour(X,Y,Z);
set(h,'ShowText','on','TextStep',get(h,'LevelStep')*2)
h3 = findall(0,'userdata',-0.2,'type','patch')
set(h3,'EdgeColor',[0 0 0])

"Bahari " <baid69@yahoo.co.uk> wrote in message <h5ovhi\$jug\$1@fred.mathworks.com>...
> Dear All,
> I want to color my contour base on value of Z, if Z<=1 the color will be white and if Z>1 the color will be light gray.
> I succeed to plot the contour with the label as command below but still not success to coloring it.
>
> [C,h]=contour(X,Y,Z);
> clabel(C,h,'FontSize',10,'Rotation',0);
> colormap gray
>
> Thanks in advance for help.
>
> Bahari

Date Subject Author
8/10/09 Bahari
8/10/09 Amin Bashi
8/10/09 Bahari
8/10/09 Lorenzo Guerrasio
8/10/09 Bahari
8/10/09 Lorenzo Guerrasio
8/10/09 Bahari