[scilab-Users] Equivalent of matlab area plot

Samuel GOUGEON Samuel.Gougeon at univ-lemans.fr
Fri Jan 21 15:44:24 CET 2011


  Hello,

----- Message d'origine -----
De : Ruben Bibas
Date : 21/01/2011 13:44:
> Hi everyone,
>
> I am currently trying to convert my matlab code to Scilab that was area plots.
> Is there an equivalent in Scilab?
>   Any comments are appreciated, even just suggestions or websites that
> can help are also appreciated.
>
> Thank you

Herebelow  is an example with any number of curves.
Cheers
Samuel
--------------
// area()

y = [1  5  3;  // Data
      3  2  7;
      1  5  3;
      2  6  1];

[nL, nC] = size(y);
x=[ 1 1:nL nL];
base = min(y)-1;              // Base level
bottom = ones(1,nC)*base;     // proper bottom closure
clf, plot2d(x,[ bottom ; flipdim(cumsum(y,"c"),2) ; bottom])
e = gce(); areas = e.children;  // iD of the set of curves
areas(:).polyline_style=5;      // switching to filled mode

for i=1:nC, areas(i).foreground = color(255*i/nC,0,0); end // recoloring 
according to any wish




More information about the users mailing list