Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: coloring contour plot
Date: Mon, 10 Aug 2009 13:12:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 33
Message-ID: <h5p6b3$t35$1@fred.mathworks.com>
References: <h5ovhi$jug$1@fred.mathworks.com> <h5p4mj$i9b$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1249909923 29797 172.30.248.38 (10 Aug 2009 13:12:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 10 Aug 2009 13:12:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1653683
Xref: news.mathworks.com comp.soft-sys.matlab:562102


Thanks Amin Bashi. 

I tried your example but seem not as I expected. The background of contour is black, the label is white and the isoline is colorfull.
I'm not sure what wrong. 

Regards

Bahari

"Amin Bashi" <matlabedu.ir.nospam@gmail.com> wrote in message <h5p4mj$i9b$1@fred.mathworks.com>...
> 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