Hello,

Le 24/09/2015 05:11, Robert McLean MD PhD a écrit :
So here is what I did for the stairs graph:
.../...
function stairs(x,y)
     n=length(x);
     x_indices=int((1:2*n-1)/2)+1; // gives 1,2,2,3,3,...,2n-1,2n-1
     x_ss=x(x_indices);  // the stair step graph's x values
     y_indices=int((2:2*n)/2);  // gives 1,1,2,2,...,2n-2,2n-2,2n-1
     y_ss=y(y_indices)
     plot2d(x_ss,y_ss)
endfunction

// We create an example:
n=10;
x=linspace(0,2,n);
x=x.*x;  //irregularly spaced x interval points from 0 to 4
y=sin(x*%pi);
stairs(x,y)
// either
plot2d2(x,y)

// or..
plot2d(x,y)
e = gce();
e.children(1).polyline_style=2;
// does the same

The polyline_style property enables switching between various plotting modes.
help Graphics // http://help.scilab.org/docs/5.5.2/en_US/Graphics.html
help polyline_properties // http://help.scilab.org/docs/5.5.2/en_US/polyline_properties.html

HTH
Samuel Gougeon

_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to