H1D histogram on SHPlot canvas (a singleton).
Code: "canvas2D_shplot.py". Programming language: Python DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_shplot_3198.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
from java.util import Random
from jhplot  import H1D,SHPlot

c1 = SHPlot.getCanvas()
c1.visible()
c1.setAutoRange()
c1.setGTitle("Global labels: F_{2},  x_{γ}  #bar{p}p F_{2}^{c#bar{c}}"); #put title

h1 = H1D("Simple1",20, -2.0, 2.0)
rand = Random()
# fill histogram
for i in range(2000):
      h1.fill(rand.nextGaussian())      

c1.draw(h1)

You see the box below because you did not login.