Histogram in HPlot using jruby
Code: "canvas2D_jhplot.rb". Programming language: Ruby DMelt Version 1. Last modified: 05/09/2015. License: Free
https://datamelt.org/code/cache/canvas2D_jhplot_6109.rb
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.



require 'java'

# print $CLASSPATH

# require 'lib/system/jhplot.jar'

java_import Java::jhplot.HPlot
java_import Java::jhplot.H1D

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


h1 = H1D.new("Simple1",100, -2, 2.0)
rand =java.util. Random.new()


print "Use of for loop in JRuby \n"
for i in 1..100
   puts "Test Value is => #{i}"
   h1.fill(rand.nextGaussian())
  end

c1.draw(h1)