Showing a steam of data on SPlot (real-time)
Code: "canvas2D_stream.py". Programming language: Python DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_stream_6465.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



from java.util import Random
from jhplot  import *
import time

c1 = SPlot()
c1.visible()
c1.setAutoRange()

c1.setMarksStyle('various')
c1.setConnected(1, 0)
c1.setNameX('Time')
c1.setNameY('Data') 

r = Random()
for i in range(100):
   x=r.nextGaussian() 
   y=r.nextGaussian()  
   c1.addPoint(0,x,y,1)
   c1.update()
   time.sleep(0.5)

You see the box below because you did not login.