[Scilab-users] ?==?utf-8?q? ?==?utf-8?q? stripchart?

Antoine Monmayrant antoine.monmayrant at laas.fr
Wed Apr 26 15:56:33 CEST 2017


Hi Steve,

I don't think stripcharts exist in Scilab.
That being said, you can emulate them pretty easily.
See below the most simple example of such an emulation.
In a more realistic scenario, you could replace my loop by a callback function that updates the plot everytime a new datapoint is measured.

Hope it helps,

Antoine

//////////////////////////////////////////////////////////
npts=100;

y=rand(1,100);
x=1:npts;

h=scf();
h.children.tight_limits="on";
plot(x,y,'k.-');
xlabel('Time')
ylabel('Data')
e=gce();//handle to the plot

//dummy loop to simulate data generation and plotting
for i=1:1000
    oldxy=e.children.data;//old data
    
    newy=rand();//this would be your recently measured Y
    newx=oldxy($,1)+1;//this would be your recently measured X
    newxy=[oldxy(2:$,:);[newx,newy]];
    e.children.data=newxy;//update data
    xmin=min(newxy(:,1));
    xmax=max(newxy(:,1));
    ymin=min(newxy(:,2));
    ymax=max(newxy(:,2));
    e.parent.data_bounds= [xmin,ymin; xmax,ymax];//rescale plot
    sleep(50)//wait a bit for a slow scroll
end
//////////////////////////////////////////////////////////

 
Le Mercredi, Avril 26, 2017 15:30 CEST, shorne at energetiq.com a écrit: 
 
> 
> In doing some real-time work I would find a stripchart very useful.
> I have a process generating (say) 10 values/second,
> that emits two values  (Time,Temperature).  This might be an xcos
> calculation, or a realtime data stream.
> 
> I would like to plot this data on a "stripchart" - to show only the (say)
> latest 10 seconds of data,
> with the plot scrolling to the left - new points  added to the right, data
> falls off the end on the left.
> 
> Digging through the docs I find no trace of such a creature.
> 
> Am I missing something obvious, or do we not have this capability in
> scilab?
> 
> Thanks,
> Steve




More information about the users mailing list