Example using H1D histograms using Java
Code: "histo1.java". Programming language: Java
DMelt Version 1. Last modified: 12/12/2015. License: Free
https://datamelt.org/code/cache/histo1_6854.java
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.
import java.awt.Color;
import java.util.Random;
import jhplot.*;
class histo1
{
public static void main(String[] args)
{
HPlot c1 = new HPlot("Canvas",600,400,1,1);
c1.setGTitle("Global title for F_{2} and x_{γ} ");
c1.visible(true);
c1.setAutoRange();
H1D h1 = new H1D("Simple1",20, -2.0, 2.0);
Random rand = new Random();
for (int i=0; i<100; i++) h1.fill(rand.nextGaussian());
c1.draw(h1);
h1.setColor(Color.blue);
h1.setPenWidthErr(2);
c1.setNameX("Xaxis");
c1.setNameY("Yaxis");
c1.setName("Canvas title");
c1.drawStatBox(h1);
c1.update();
// make png figure
c1.export("test.png");
}
}