HPlotXY canvas for histograms and X-Y data
Code: "canvas2D_hplotxy.py". Programming language: Python DMelt Version 1. Last modified: 05/09/2015. License: Pro
https://datamelt.org/code/cache/canvas2D_hplotxy_5549.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,Font
from java.util import Random
from jhplot import * 

c1 =HPlotXY("Canvas",600,400)
c1.visible()
c1.setGTitle("Test")
c1.setNameX("X_n")
c1.setNameY("Y-values")

p2=P1D("data")

h1 = H1D("Simple1",20, -1.0, 1.0)
h1.setFill(True)
h1.setFillColor(Color(50,200,100))
h1.setLineStyle(2)

rand = Random()
for i in range(1000):
     h1.fill(rand.nextGaussian());
     p2.add(10*rand.nextGaussian(),20+rand.nextGaussian()*10);

c1.setRangeY(0,100)
c1.setRangeX(-1.2,1.2)

c1.draw(h1)
c1.draw(p2)

# c1.export("test.svg");

You see the box below because you did not login.