Beispiel #1
0
#  H1D histogram. Example  I
# S.Chekanov


from java.awt import Color
from java.util import Random
from jhplot  import HPlot,H1D,HLabel


c1 = HPlot("Canvas",600,400)  
c1.setGTitle("Global labels: F_{2} ,  x_{γ}  #bar{p}p F_{2}^{c#bar{c}}"); #put title
c1.visible(1)
c1.setAutoRange()



h1 = H1D("Simple1",20, -2.0, 2.0)
rand = Random()
# fill histogram
for i in range(100):
      h1.fill(rand.nextGaussian())      


c1.draw(h1)
h1.setPenWidthErr(2)
c1.setNameX("Xaxis")
c1.setNameY("Yaxis")
c1.setName("Canvas title")
c1.drawStatBox(h1)

Beispiel #2
0
# Function | C | 1.7 | S.Chekanov | A function in 1D (F1D).   

from java.awt import Font,Color
from jhplot  import HPlot,F1D

c1 = HPlot("Canvas",800,400,2, 1)
c1.setGTitle("Example of functions", Color.red) #put title
c1.setNameX("Xaxis")
c1.setNameY("Yaxis")
c1.setName("Canvas title")
c1.visible(1)
c1.setAutoRange()

f1 = F1D("2*exp(-x*x/50)+sin(pi*x)/x", -2.0, 5.0)
f1.setPenDash(4)
c1.draw(f1)

f1 = F1D("exp(-x*x/50)+pi*x", -2.0, 5.0)
f1.setColor(Color.green)
f1.setPenWidth(1)
c1.draw(f1)

c1.cd(2,1)
c1.setAutoRange()

f1 = F1D("20*x*x", -2.0, 5.0)
f1.setColor(Color.red)
f1.setPenWidth(3)
c1.draw(f1)

f1 = F1D("10*sqrt(x)+20*x", 0.1, 10.0)
# Physics/HEP | C | 1.7 | S.Chekanov | A typical world's summary plot

from jhplot import HPlot, HLabel, P1D
from java.awt import Color, Font

c1 = HPlot("summary plot", 550, 650)
c1.setGTitle("B_{2} summary")
f = Font("Lucida Sans", Font.BOLD, 20)
c1.setNameX("Centre-of-mass energy (GeV)", f, Color.black)
c1.setNameY("B_{2} GeV^{-2}", f, Color.black)

c1.setRange(0.1, 1000, 0.0001, 0.2)
c1.setLogScale(0, 1)
c1.setLogScale(1, 1)
c1.setGrid(0, 0)
c1.setGrid(1, 0)
c1.visible()

c = Color(100, 10, 200)
p1 = P1D("γ p #bar{d} (ep, H1)")
p1.setSymbolSize(8)
p1.setSymbol(7)
p1.setPenWidthErr(2)
p1.setErrColor(c)
p1.setColor(c)
p1.add(210, 0.01, 0.0, 0.0, 0.001, 0.001, 0.0, 0.0, 0.002, 0.002)

c = Color.black
p2 = P1D("DIS #bar{d}(ep, ZEUS)")
p2.setErrColor(c)
p2.setSymbolSize(8)