Showing a steam of 2D data using HPlot
Source code name: "canvas2D_stream_jhplot.py"
Programming language: Python
Topic: Plots/Real time
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_stream_jhplot_2902.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 java.awt import *
from jhplot  import *

c1 = HPlot("Test")
c1.visible()
c1.setRange(-2,2,-2,2)
c1.setNameX('Time')
c1.setNameY('Data') 
c1.setLegend(0)

r = Random()
import time
p=P1D("test")
p.setColor(Color.red)
p.setSymbolSize(10)
for i in range(100):
   c1.clearData()
   p.clear()
   x=r.nextGaussian() 
   y=r.nextGaussian()
   p.add(x,y)  
   c1.draw(p)
   time.sleep(0.01)


You see the box below because you did not login.