 |
Two H2D histograms shown on same 3D plot (HPlot3D)
Source code name: "histo2D_2h.py"
Programming language: Python
Topic: Histograms/2D
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/histo2D_2h_4797.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 jhplot import HPlot3D,H2D
from java.util import Random
c1 = HPlot3D("Canvas",600,400)
c1.setGTitle("Histogram test")
c1.setNameX("X axis")
c1.setNameY("Y axis")
c1.visible(1)
h1 = H2D("My 2D Test 1",30,-3.0, 3.0, 30, -3.0, 3.0)
h2 = H2D("My 2D Test 2",30,-3.0, 3.0, 30, -3.0, 3.0)
rand = Random()
for i in range(5000):
h1.fill(0.4*rand.nextGaussian(),rand.nextGaussian())
for i in range(4000):
h2.fill(0.2*rand.nextGaussian()+2.0,0.5*rand.nextGaussian()+1.0)
c1.setRangeZ(0,250)
c1.draw(h2,h1)
# export to some image (png,eps,pdf,jpeg...)
# c1.export(Editor.DocMasterName()+".png")
You see the box below because you did not login.