import hep.aida.*;
import java.util.Random;

public class Example3 {

  public static void main(String[] args)throws Exception {
    IAnalysisFactory af = IAnalysisFactory.create();
    IHistogramFactory hf = af.createHistogramFactory(null);
    IHistogram2D h2 = hf.createHistogram2D("Example2", 20, -3, 3, 20,-3,3);

    Random r = new Random(1234567);
    for (int i = 0; i < 10000; i++) {
      h2.fill(r.nextGaussian(),r.nextGaussian());
    }

    IPlotterFactory pf = af.createPlotterFactory();
    IPlotter plotter = pf.create();
    plotter.createRegions(1,3);

    IPlotterStyle regionStyle0 = plotter.region(0).style();
    IPlotterStyle regionStyle1 = plotter.region(1).style();
    IPlotterStyle regionStyle2 = plotter.region(2).style();
    regionStyle0.setParameter("hist2DStyle","box");
    regionStyle1.setParameter("hist2DStyle","ellipse");
    regionStyle2.setParameter("hist2DStyle","colorMap");

    plotter.region(0).plot(h2);
    plotter.region(1).plot(h2);
    plotter.region(2).plot(h2);

    plotter.writeToFile("Example3.eps");
    plotter.show();
  }
}
