[Scilab-users] stripchart?

classic Classic list List threaded Threaded
6 messages Options
shorne shorne
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] stripchart?

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
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

Christophe Dang Ngoc Chan Christophe Dang Ngoc Chan
Reply | Threaded
Open this post in threaded view
|

Re: {EXT} stripchart?

Hello

> De : [hidden email]
> Envoyé : mercredi 26 avril 2017 15:31
>
> 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.

From what I understand,
you could do this by extracting the last lines of the matrix of data
and then updating the data property of the polyline with this submatrix, see
https://help.scilab.org/docs/6.0.0/en_US/polyline_properties.html
but this needs to be tested as there will probably be side effects.

HTH

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? ?==?utf-8?q? stripchart?

In reply to this post by shorne
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, [hidden email] 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

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? {EXT} stripchart?

In reply to this post by Christophe Dang Ngoc Chan
Le Mercredi, Avril 26, 2017 15:50 CEST, "Dang Ngoc Chan, Christophe" <[hidden email]> a écrit:
 

> Hello
>
> > De : [hidden email]
> > Envoyé : mercredi 26 avril 2017 15:31
> >
> > 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.
>
> From what I understand,
> you could do this by extracting the last lines of the matrix of data
> and then updating the data property of the polyline with this submatrix, see
> https://help.scilab.org/docs/6.0.0/en_US/polyline_properties.html
> but this needs to be tested as there will probably be side effects.

I just posted a proposition that use exactly this idea.
No side effect, but you have to handle the rescaling of the plot.

Antoine

>
> HTH
>
> --
> Christophe Dang Ngoc Chan
> Mechanical calculation engineer
> This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
shorne shorne
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? ?==?utf-8?q? stripchart?

In reply to this post by Antoine Monmayrant

Antoin,e, thanks.
This is essentially what I was looking for.

I haven't used Xcos much - but I presume this could be wrapped up to use there?

Thanks again -
Steve

<script language="JavaScript" type="text/javascript"> <!-- function _dSectionExpand(sec) { document.getElementById("cSec"+sec).style.display = "none"; document.getElementById("xSec"+sec).style.display = "block"; } function _dSectionCollapse(sec) { document.getElementById("xSec"+sec).style.display = "none"; document.getElementById("cSec"+sec).style.display = "block"; } // --> </script>

<a href="javascript:_dSectionExpand('1')" onclick="return _dSectionExpand('1');">Show details for "Antoine Monmayrant" ---04/26/2017 09:54:50 AM---Hi Steve, I don't think stripcharts exist in Scilab.<a onclick="return _dSectionExpand('1');">"Antoine Monmayrant" ---04/26/2017 09:54:50 AM---Hi Steve, I don't think stripcharts exist in Scilab.
<a href="javascript:_dSectionCollapse('1')" onclick="return _dSectionCollapse('1');">Hide details for "Antoine Monmayrant" ---04/26/2017 09:54:50 AM---Hi Steve, I don't think stripcharts exist in Scilab.<a onclick="return _dSectionCollapse('1');">"Antoine Monmayrant" ---04/26/2017 09:54:50 AM---Hi Steve, I don't think stripcharts exist in Scilab.

From: "Antoine Monmayrant" <[hidden email]>
To: "Users mailing list for Scilab" <[hidden email]>
Date: 04/26/2017 09:54 AM
Subject: Re: [Scilab-users] ?==?utf-8?q? ?==?utf-8?q? stripchart?
Sent by: "users" <[hidden email]>




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, [hidden email] 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

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

<script language="JavaScript" type="text/javascript"> <!-- _dSectionExpand('1'); // --> </script>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? ?==?utf-8?q? stripchart?

In reply to this post by Antoine Monmayrant
----- Mail original -----
Objet: Re: [Scilab-users] ?==?utf-8?q? ?==?utf-8?q? stripchart?

>//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

You can replace all the following

>    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

with only

     replot // or: replot tight

>    sleep(50)//wait a bit for a slow scroll
>end

and that's it

Samuel
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users