[Scilab-users] ?==?utf-8?q? Same color for contour isolines

Antoine Monmayrant antoine.monmayrant at laas.fr
Fri Mar 17 14:01:24 CET 2017


Le Jeudi, Mars 16, 2017 11:32 CET, Jens Simon Strom <j.s.strom at hslmg.de> a écrit: 
 
> Hi,
> How would you avoid the loop in the following example?

By setting the colormap beforehand so that is only contains the color you want:

n2_=-1000:200:1000;
nS_=-1000:200:1000;
[N2,NS]=ndgrid(n2_,nS_);
N1=2.6*N2+(3.6)*NS;
xdel();

levels=[-60:10:60];
h=scf();
h.color_map=(ones(levels)).'*[0,1, 0];// replace the green [0,1, 0]; by any rgb color you want
contour(n2_,nS_,N1/100,levels);

It's a workaround, it's ugly, but it does the job: "Look ma', no loop!".

Hope it helps,

Antoine


> 
> n2_=-1000:200:1000;
> nS_=-1000:200:1000;
> [N2,NS]=ndgrid(n2_,nS_);
> N1=2.6*N2+(3.6)*NS;
> xdel();
> contour(n2_,nS_,N1/100,[-60:10:60])
> 
> ca=gca();  Comp=ca.children;  //colum matrix of handles: (Compound)
> nComp=length(Comp);
> for  k=1:nComp
>   Comp(k).children.foreground=3;     
> end
> 
> Regards
> Jens
> 
>




More information about the users mailing list