[Scilab-users] grayplot

Samuel Gougeon sgougeon at free.fr
Thu Oct 27 20:15:09 CEST 2016


Le 27/10/2016 18:50, Rafael Guerra a écrit :
> Hi Samuel,
>
> Scilab-6  'scatter' plot function seems indeed quite adequate for these data.
> Would it be possible to produce such scatter plots with dots color coded (as attached) in Scilab 5?
.
yes it is, for instance using xfarcs() as below.
Regards

np  =  40;     // number of points
x  =  grand(1,np,  "unf",  -20,  140);
y  =  grand(1,np,  "unf",  -50,  300);
dz  =  6.4;
z  =  grand(1,np,  "unf",  -dz,  dz);

clf
f  =  gcf();
nc  =  100;
f.color_map  =  jetcolormap(nc);
plotframe([-20  -50  140  300])
c  =  round((z+dz)/(2*dz)*(nc-1)+1);  // colors of dots scaled against their z
// shaping dots
ar  =  f.axes_size;  ar  =  ar(1)/ar(2);  // w/h aspect ratio of figure
dotsize_r  =  0.04;    // relative size of dots
h  =  strange(y)*dotsize_r;
w  =  strange(x)*dotsize_r/ar;
dots  =  [x  ;  y  ;  ones(x)*w  ;  ones(x)*h  ;  zeros(x)  ;  ones(x)*64*360];
// plotting dots
xfarcs(dots,  c);
// colorbar
colorbar(-dz,dz)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20161027/cdb81a0b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bdaefgij.png
Type: image/png
Size: 8775 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20161027/cdb81a0b/attachment.png>


More information about the users mailing list