 |
A H1D histogram in the log scale
Source code name: "histo_log.py"
Programming language: Python
Topic: Histograms/1D
DMelt Version 1. Last modified: 12/12/2015. License: Pro
https://datamelt.org/code/cache/histo_log_6675.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.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)
You see the box below because you did not login.