
from java.awt import Color,Font
from java.util import Random
from jhplot  import *

c1 = HPlot("Canvas",600,400,2,1)
c1.setGTitle("Log scale test", Color.red)
c1.setLegend(0)
c1.setNameX("X")
c1.setNameY("Y")
c1.visible(1)
c1.setAutoRange()


h1 = H1D("My Test 1",20, 1.0, 20.0)
h1.setErrX(0)
h1.setErrY(1)

rand = Random()
for i in range(1000):
      x=20-10*rand.nextGaussian()
      h1.fill(x)

# show X in log scale, Y in linear scale
c1.setRange(1,100,0,20)
c1.setLogScale(0,1)
c1.setLogScale(1,0)
c1.cd(1,1)
c1.draw(h1)


# show X and Y in log scale
c1.cd(2,1)
c1.setNameX("X")
c1.setNameY("Y")
c1.setLegend(0)
c1.setRange(1,100,1,100)
c1.setLogScale(0,1)
c1.setLogScale(1,1)
h1.setFill(1)
c1.draw(h1)
