<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Under Scilab-5.5.2 xfpoly rescale the
      graph automatically as plot does<br>
      <br>
      A little more simple (efficient?) code:<br>
      <br>
      t = [ 0  2  5 10 12 17 20 30 35 45 60]'*0.1;<br>
      N = [20 18 15 14 12  9  6  4  3  2  1]';<br>
      <br>
      t2=matrix([t' t($); t' t($)],-1,1);<br>
      N2=matrix([0 N'; N' 0],-1,1)<br>
      <br>
      clf;<br>
      xfpoly(t2,N2);<br>
      h = gce();<br>
      h.line_mode = "off";<br>
      h.background = color('gray');<br>
      plot(t2(2:$-1),N2(2:$-1),'black',
      t2(2:$-1),21*exp(-t2(2:$-1)/2),'red');<br>
       <br>
      <br>
      <br>
      <br>
       <br>
      Le 07/10/2015 09:58, Antoine Monmayrant a écrit :<br>
    </div>
    <blockquote cite="mid:5614D091.9020103@laas.fr" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">Le 10/07/2015 09:41 AM, Yann DEBRAY a
        écrit :<br>
      </div>
      <blockquote cite="mid:5614CCA1.8000301@scilab-enterprises.com"
        type="cite">
        <meta content="text/html; charset=windows-1252"
          http-equiv="Content-Type">
        Hello Raphael,<br>
        <br>
        Nice plot, but sadly it doesn't rescale.<br>
        Do you have an idea how to make it fit the axes, to rescale
        automatically?<br>
      </blockquote>
      <br>
      You can calculate your data_bounds and set them after plotting.<br>
      Alernatively, use my method that does not rely on xfpoly, but on
      plot that rescales automatically:<br>
      <br>
      //I want to staircase plot N(Decay_times)<br>
          N=[N2,N2-cumsum(ones(Decay_times))+1];<br>
          Np1=[N2-cumsum(ones(Decay_times))+1,0];<br>
          Ns=matrix([N;Np1],2*prod(size(N)));<br>
          Decay_times=[0,Decay_times];<br>
          <br>
         
      D_t=matrix([Decay_times;Decay_times],2*prod(size(Decay_times)));<br>
      //in the end, I plot Ns(D_t)<br>
          Ns=[0;Ns];<br>
          D_t=[0;D_t];<br>
      //plot it<br>
          plot(D_t,Ns, 'k-');<br>
      //fill the bacground<br>
          e=gce();<br>
          e.children.polyline_style=1;<br>
          e.children.closed='off';<br>
          e.children.background=color('gray');<br>
      <br>
      <blockquote cite="mid:5614CCA1.8000301@scilab-enterprises.com"
        type="cite"> <br>
        Yann<br>
        <br>
        <div class="moz-cite-prefix">Le 07/10/2015 00:17, Rafael Guera a
          écrit :<br>
        </div>
        <blockquote
          cite="mid:BLU436-SMTP20052F19EA9E25D4BF40C18CC370@phx.gbl"
          type="cite">
          <pre wrap="">Hello Antoine,
 
An attempt below, not particularly clean but I hope not too dirty either:
 
//INPUT
t = [ 0  2  5 10 12 17 20 30 35 45 60]'*0.1;
N = [20 18 15 14 12  9  6  4  3  2  1]';
 
t2=[];N2=[];
ns= length(t);
t2(1:2:2*ns) = t;  
t2(2:2:2*ns) = [t(2:$)-%eps; t($)];
N2(1:2:2*ns-1) = N;
N2(2:2:2*ns) = N;
clf;
xfpoly([t2(1)-%eps;t2;t2($)+%eps],[0;N2;0]);
h = gce();
h.line_mode = "off";
h.background = color('gray');
plot(t2,N2,'black', t2,21*exp(-t2/2),'red');
 
 
Regards,
 
Rafael
 
-----Original Message-----
From: users [<a moz-do-not-send="true" class="moz-txt-link-freetext" href="mailto:users-bounces@lists.scilab.org">mailto:users-bounces@lists.scilab.org</a>] On Behalf Of Antoine Monmayrant
Sent: Tuesday, October 06, 2015 10:57 AM
To: Users mailing list for Scilab <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:users@lists.scilab.org"><users@lists.scilab.org></a>
Subject: Re: [Scilab-users] How to produce a filled staircase plot
 
Thank you Serge for this solution, but it does not work for me: the "bars" in my case are not regular.
I am simulating an exponential random decay: starting from a number N0, my population decreases by jumps of N0->N0-1 that occur at random times, following an exponential law (see the attached plot).
For the moment, I just build my polygon by hand, but it adds quite a lot of "noise" on top of the code that I intent to show to my students.
I was hoping for a cleaner solution.
 
Thanks anyway,
 
Cheers,
 
Antoine
 
Le Mardi 6 Octobre 2015 11:42 CEST, Serge Steer < <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:Serge.Steer@inria.fr"><mailto:Serge.Steer@inria.fr></a> <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Serge.Steer@inria.fr">Serge.Steer@inria.fr</a>> a écrit: 
 
</pre>
          <blockquote type="cite">
            <pre wrap="">Le 06/10/2015 00:01, Antoine Monmayrant a écrit :
</pre>
            <blockquote type="cite">
              <pre wrap="">Hi everyone,

I'm trying to do a filled staircase plot (ie a staircase where the area between the staircase and the x axis is filled with a solid color).
Is there a given combination of polyline_style and fill_mode, etc ... that can do this?
Or should I resort to building a polygon by hand?

Thanks in advance,

Antoine

_______________________________________________
users mailing list
 <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:users@lists.scilab.org"><mailto:users@lists.scilab.org></a> <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
 <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://lists.scilab.org/mailman/listinfo/users"><http://lists.scilab.org/mailman/listinfo/users></a> <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>

</pre>
            </blockquote>
            <pre wrap="">May be the bar mode can help you
x=linspace(0,%pi,10);y=sin(x);
clf;plot(x,y);e=gce();e=e.children;
e.polyline_style=6;e.bar_width=0.5;
e.background=2;
e.line_mode="off";
_______________________________________________
users mailing list
 <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:users@lists.scilab.org"><mailto:users@lists.scilab.org></a> <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
 <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://lists.scilab.org/mailman/listinfo/users"><http://lists.scilab.org/mailman/listinfo/users></a> <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>

</pre>
          </blockquote>
          <pre wrap=""> 
 
 
 
 

</pre>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
        </blockquote>
        <br>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
      </blockquote>
      <br>
      <br>
      <pre class="moz-signature" cols="72">-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++

 Antoine Monmayrant LAAS - CNRS
 7 avenue du Colonel Roche
 BP 54200
 31031 TOULOUSE Cedex 4
 FRANCE

 Tel:+33 5 61 33 64 59
 
 email : <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:antoine.monmayrant@laas.fr">antoine.monmayrant@laas.fr</a>
 permanent email : <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:antoine.monmayrant@polytechnique.org">antoine.monmayrant@polytechnique.org</a>

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>