from java.awt import Color
from java.util import Random
from java.lang import Thread
from jhplot import HPlot,H1D
import time
c1 = HPlot("Canvas",600,400)
c1.setGTitle("Histogram from stream of data (in real time)")
c1.visible(1)
c1.setLegend(0)
#c1.setAutoRange()
c1.setRange(-3,3,0,30)
h1 = H1D("Gaussian numbers every 0.5 sec",20, -2.0, 2.0)
h1.setFill(1)
h1.setErrX(0)
h1.setErrY(1)
h1.setFillColorTransparency(0.7)
h1.setFillColor(Color.blue)
h1.setColor(Color.blue)
h1.setPenWidthErr(2)
rand = Random()
for i in range(100):
h1.fill(rand.nextGaussian())
time.sleep(0.1)
c1.draw(h1)
c1.drawStatBox(h1)
time.sleep(0.5)
#c1.clearData()
Ads help maintain this website.