[Scilab-users] grayplot - colorbar

SCHULZ Wolfgang W.Schulz at ove.at
Thu Nov 24 13:01:40 CET 2016


Hi Rafael,
wow - thanks a lot. This is exactly what I need.
Thanks also to Samuel for his answer.

For my understanding: I do not understand why you have to scale the matrix and also how to scale. Could you explain what you are doing?
Mcol = 1+(Nc-1)*(M-z1)/(z2-z1); // scale data to colors indexes

Further:
- I have problems displaying a grid in the plot. It seems the standard function (xgrid) and also with the property of the figure it doesn't work.
- Something strange is also the axis label - it is displayed inside the axis. Is there an easy way to change this except a.x_label.position?

Thanks a lot
Wolfgang



> -----Ursprüngliche Nachricht-----
> Von: users [mailto:users-bounces at lists.scilab.org] Im Auftrag von Rafael
> Guerra
> Gesendet: Mittwoch, 23. November 2016 18:07
> An: Users mailing list for Scilab
> Betreff: Re: [Scilab-users] grayplot - colorbar
> 
> 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
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users



More information about the users mailing list