[Scilab-users] grayplot

Rafael Guerra jrafaelbguerra at hotmail.com
Thu Oct 27 16:19:07 CEST 2016


Hi,

Please try the tidied up code below which uses Sgrayplot instead.

/////// START OF CODE
clf();
clear;
x=[8030 8040 7998 8008 8037 7956 7937 7963 7919 7920];
y=[9478 9533 9578 9590 9597 9626 9627 9723 9766 9768];
z=[-2.39965177 1.81709373 -1.14068067 -2.95249772 -3.25881290 1.36802530 -1.46287727 ...
    -6.40911865 1.03929353 1.49115121];

n=length(z);
printf('length(x)=%i\n',length(x));
x1=min(x);
x2=max(x);
ilen=x2-x1+1;
printf('ilen=%i\n',ilen);
y1=min(y);
y2=max(y);
jlen=y2-y1+1;
printf('jlen=%i\n',jlen);
newmat= zeros(ilen,jlen);
newmat(x-x1+1,y-y1+1)=diag(z);
printf('size of newmat= %i x %i\n',size(newmat));
xaxis=1:ilen;
yaxis=1:jlen;
fig5=scf(5);
dmin=min(newmat);
dmax=max(newmat);
dmax=max(abs(dmin),abs(dmax));
dmin=-dmax;
xtitle("data")
ncol = 64;
colorbar(dmin,dmax,[1, ncol]);
Sgrayplot(xaxis,yaxis,newmat,zminmax=[dmin,dmax])
h = gcf();
h.color_map = jetcolormap(ncol);
h.color_map(int(ncol/2),1:3)=0;       // color zeros with black=0;  white=1
h.color_map(int(ncol/2+1),1:3)=0;  // idem
/////// END OF CODE

Regards,
Rafael

From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Necati Gulunay
Sent: Thursday, October 27, 2016 5:01 AM
To: users at lists.scilab.org
Subject: [Scilab-users] grayplot

I am trying to use scilab grayplot to plot a number of signed values which are distributed in the x,y plane.  

But I am getting an orange color backround in the plot even if most of the data points in the plane are zero which need to be white color according to the color map I designed. 

Could anyone please tell me what the proble may be. I am attaching the script file which contains data points and the code.


More information about the users mailing list