Using HPlot2D to show H2D histograms as a contour plot
Source code name: "canvas2D_contour1.py"
Programming language: Python
Topic: Plots/Contour
DMelt Version 1. Last modified: 08/20/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_contour1_4262.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 *

c1=HPlot2D("Canvas",800,600,2,1)
c1.visible()
c1.setAutoRange()


h1=H2D("2 Gaussians",30,-3.0, 3.0, 30, -3.0, 3.0)
r=Random()
for i in range(5000):
    h1.fill(0.6*r.nextGaussian()-0.5,r.nextGaussian())
    h1.fill(0.4*r.nextGaussian()+1,0.8*r.nextGaussian()+0.5)


c1.cd(1,1)
c1.setName("Contour style")
c1.setStyle(1)
c1.draw(h1)

c1.cd(2,1)
c1.setName("Filled style")
c1.setStyle(2)
c1.draw(h1)


You see the box below because you did not login.