 |
Showing histograms in 3D using ColorMap, Scatter, Style2D and Box styles
Source code name: "histo2D_multi.py"
Programming language: Python
Topic: Histograms/2D
DMelt Version 1. Last modified: 12/11/2015. License: Pro
https://datamelt.org/code/cache/histo2D_multi_6150.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 *
from java.util import Random
c1 = HPlotter("Canvas",700,700,2,2)
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.cd(1,1)
c1.setStatBox(0)
c1.draw(h1,"ColorMap")
c1.cd(2,1)
c1.draw(h1,"Scatter")
c1.cd(1,2)
c1.draw(h1,"Style2D")
c1.cd(2,2)
c1.draw(h1,"Box")
# export to some image (png,eps,pdf,jpeg...)
# c1.export(Editor.DocMasterName()+".png")
You see the box below because you did not login.