[Scilab-users] grayplot - colorbar
Rafael Guerra
jrafaelbguerra at hotmail.com
Wed Nov 23 18:06:52 CET 2016
Hi Wolfgang,
Please check the code below using Matplot1() function.
It was not easy to write proper code, as the help file is relatively poor for the Matplot1 function.
// START OF CODE
// plot a matrix with Matplot1
clf()
Nc= 128; // number of colors
dxp=0:5:10;
dyp=0:5:10;
x1=min(dxp);
y1=min(dyp);
M= [64 30 2; 4 5 6; 7 8 33] // M can have any real numbers
z1 = min(M);
z2 = max(M);
Mcol = 1+(Nc-1)*(M-z1)/(z2-z1); // scale data to colors indexes
ax = gca();//get current axes handle
ax.data_bounds = [min(dxp),min(dyp); max(dxp),max(dyp)]; //set the data_bounds
Matplot1(Mcol,[min(dxp),min(dyp), max(dxp),max(dyp)])
drawaxis(x=dxp,y=y1,dir='d',tics='v')
drawaxis(x=x1,y=dyp,dir='l',tics='v')
f = gcf();
f.color_map = jetcolormap(Nc);
colorbar(z1,z2,[1 Nc]);
// END OF CODE
Regards,
Rafael
-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of SCHULZ Wolfgang
Sent: Wednesday, November 23, 2016 4:05 PM
To: Users mailing list for Scilab <users at lists.scilab.org>
Subject: [Scilab-users] grayplot - colorbar
Hello,
I'm using Scilab 6 beta 2 under Win 10 and I have a problem with grayplot and a colorbar.
With the following script I would expect to have at least 1 square colored in red because I scale the colorbar to the maximum of the matrix but with grayplot it doesn't work:
map = jetcolormap(64);
f=get("current_figure");
f.color_map = map;
dxp=0:5:10;
dyp=0:5:10;
nb_xy=[64 30 2; 4 5 6; 7 8 33]
colorbar(1,max(nb_xy),[1 64]);
grayplot(dxp,dyp,nb_xy)
Using Sgrayplot shows 1 corner in red but in this case I cannot see the individual grid cells what is absolutely necessary for me.
What can I do? What is my mistake?
Thanks for your help.
Wolfgang
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list