2D histograms with some Jaida style
Source code name: "histo_jaida2D.py"
Programming language: Python
Topic: Histograms/2D
DMelt Version 1. Last modified: 12/12/2015. License: Pro
https://datamelt.org/code/cache/histo_jaida2D_2498.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 hep.aida import IAnalysisFactory 
from java.util import Random
from jhplot import *

factory = IAnalysisFactory.create();
tree = factory.createTreeFactory().create();
hf = factory.createHistogramFactory(tree);

h2 = hf.createHistogram2D("Histogram 2D",40,-3,3,40,-3,3)
c2 = hf.createCloud2D("Cloud 2D")

r = Random();
for i in range(10000) :
	h2.fill(r.nextGaussian(),r.nextGaussian());
	c2.fill(r.nextGaussian(),r.nextGaussian());


c1=HPlotter("Histogram",700,700,2,2)
c1.visible()

c1.cd(1,1)
c1.setGTitle("Histogram 2D")
style=c1.getRegionStyle()
style.setParameter("backgroundColor","yellow");
style.setParameter("foregroundColor","green");
style.setParameter("hist2DStyle","ellipse");
style.dataStyle().markerStyle().setColor("blue");
c1.draw(h2,style);

c1.cd(2,1)
c1.setGTitle("Color Map")
style=c1.getRegionStyle()
style.setParameter("showStatisticsBox","false");
style.setParameter("hist2DStyle","colorMap");
style.dataStyle().fillStyle().setParameter("colorMapScheme","rainbow");
c1.draw(h2,style)


c1.cd(1,2)
c1.setTitle("Points");
style=c1.getRegionStyle()
style.dataStyle().markerStyle().setColor("red");
style.dataStyle().markerStyle().setShape("1");
style.dataStyle().markerStyle().setParameter("size","7");
c1.draw(c2,style)

c1.cd(2,2)
c1.setGTitle("Color Map")
style=c1.getRegionStyle()
style.setParameter("showAsScatterPlot","false");
c1.draw(c2,style)


You see the box below because you did not login.