 |
HPlotJa shows several histograms in two pads
Source code name: "canvas2D_hplotja1.py"
Programming language: Python
Topic: Plots/2D
DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_hplotja1_5343.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 = HPlotJa("Canvas",800,400,2,1)
c1.setAntiAlias(False)
c1.setGTitle("Title")
c1.visible()
h1 = H1D("e^{+}e^{-} → W^+{}W^{-} → 4J",20, -2.0, 2.0)
rand = Random()
# fill histogram
for i in range(500):
h1.fill(rand.nextGaussian())
h1.setFill(1)
h1.setFillColor(Color.green)
h1.setErrX(0)
h1.setErrY(1)
h1.setPenWidthErr(2)
h2 = H1D("e^{+}e^{-} → Z/γ → X ",15, -2.0, 2.0)
h2.setFill(1)
h2.setErrX(0)
h2.setErrY(1)
h2.setFillColorTransparency(0.7)
h2.setFillColor(Color.red)
h2.setColor(Color.red)
h2.setErrColorY(Color.blue)
h2.setNameX("X of H2")
h2.setNameY("Y of H2")
for i in range(1000):
h2.fill(2+rand.nextGaussian())
c1.cd(1,1)
c1.setAutoRange()
# set range
# c1.setRange(-4,4,0.0,100)
c1.setLegendFont( Font("Lucida Sans", Font.BOLD, 14) )
c1.setNameX("Text Examples:− θ π ω ∫ ∑")
c1.setNameY("Yaxis")
c1.setName("Canvas title: √(1− e)")
c1.draw(h1)
c1.cd(2,1)
c1.setAutoRange()
c1.draw(h2)
# c1.clearAll()
# c1.update()
# export to some image (png,eps,pdf,jpeg...)
# c1.export(Editor.DocMasterName()+".png");
You see the box below because you did not login.