from jhplot import *
from java.util import Random
h1=H1D("test H1D",20,-3,3)
h1.setFill(1)
p0=P0D("test P0D")
r=Random() # fill with random numbers
for i in range(100):
h1.fill(2*r.nextGaussian())
p0.add(r.nextGaussian()+10)
a=[] # put both objects to the list
a.append(h1)
a.append(p0)
IO.writeXML(a,'file.xml') # write to a XML file
print IO.toXML(a) # convert to XML string
b=IO.readXML('file.xml') # read back from XML
print b
Ads help maintain this website.