public void DrawSemivariogram(bin[][] bins,Variogram variogram){
  XYSeriesCollection sampleCollct=new XYSeriesCollection();
  XYSeries series=new XYSeries("Sample Variogram");
  XYLineAndShapeRenderer xylineshapRend=new XYLineAndShapeRenderer(false,true);
  CombinedRangeXYPlot combinedrangexyplot=new CombinedRangeXYPlot();
  for (int i=0; i < bins[0].length; i++) {
    for (int k=0; k < bins.length; k++) {
      if (!Double.isNaN(bins[k][i].Value)) {
        series.add(bins[k][i].Distance,bins[k][i].Value);
      }
    }
    sampleCollct.addSeries(series);
    double[][] res=CalcTheoreticalSVValues(variogram,series.getMaxX());
    XYSeries seriesTSV=new XYSeries("Theoretical Variogram");
    for (int l=0; l < res.length; l++) {
      seriesTSV.add(res[l][0],res[l][1]);
    }
    XYSeriesCollection theorCollct=new XYSeriesCollection();
    theorCollct.addSeries(seriesTSV);
    XYDataset xydataset=sampleCollct;
    XYPlot xyplot1=new XYPlot(xydataset,new NumberAxis(),null,xylineshapRend);
    xyplot1.setDataset(1,theorCollct);
    XYLineAndShapeRenderer lineshapRend=new XYLineAndShapeRenderer(true,false);
    xyplot1.setRenderer(1,lineshapRend);
    xyplot1.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    combinedrangexyplot.add(xyplot1);
  }
  DecimalFormat df=new DecimalFormat("###,##0.000");
  String title="Semivariogram (RMSE = " + df.format(Math.sqrt(variogram.mse)) + ")";
  JFreeChart chart=new JFreeChart(title,JFreeChart.DEFAULT_TITLE_FONT,combinedrangexyplot,true);
  ChartFrame frame=new ChartFrame("Semivariogram",chart);
  frame.pack();
  frame.setVisible(true);
}

public void DrawSemivariogram ( bin [ ] [ ] bins , Variogram variogram ) { XYSeriesCollection sampleCollct = new XYSeriesCollection ( ) ; XYSeries series = new XYSeries ( "Sample Variogram" ) ; XYLineAndShapeRenderer xylineshapRend = new XYLineAndShapeRenderer ( false , true ) ; CombinedRangeXYPlot combinedrangexyplot = new CombinedRangeXYPlot ( ) ; for ( int i = 0 ; i < bins [ 0 ] . length ; i ++ ) { for ( int k = 0 ; k < bins . length ; k ++ ) { if ( ! Double . isNaN ( bins [ k ] [ i ] . Value ) ) { series . add ( bins [ k ] [ i ] . Distance , bins [ k ] [ i ] . Value ) ; } } sampleCollct . addSeries ( series ) ; double [ ] [ ] res = CalcTheoreticalSVValues ( variogram , series . getMaxX ( ) ) ; XYSeries seriesTSV = new XYSeries ( "Theoretical Variogram" ) ; for ( int l = 0 ; l < res . length ; l ++ ) { seriesTSV . add ( res [ l ] [ 0 ] , res [ l ] [ 1 ] ) ; } XYSeriesCollection theorCollct = new XYSeriesCollection ( ) ; theorCollct . addSeries ( seriesTSV ) ; XYDataset xydataset = sampleCollct ; XYPlot xyplot1 = new XYPlot ( xydataset , new NumberAxis ( ) , null , xylineshapRend ) ; xyplot1 . setDataset ( 1 , theorCollct ) ; XYLineAndShapeRenderer lineshapRend = new XYLineAndShapeRenderer ( true , false ) ; xyplot1 . setRenderer ( 1 , lineshapRend ) ; xyplot1 . setDatasetRenderingOrder ( DatasetRenderingOrder . FORWARD ) ; combinedrangexyplot . add ( xyplot1 ) ; } DecimalFormat df = new DecimalFormat ( "###,##0.000" ) ; String title = "Semivariogram (RMSE = " + df . format ( Math . sqrt ( variogram . mse ) ) + ")" ; JFreeChart chart = new JFreeChart ( title , JFreeChart . DEFAULT_TITLE_FONT , combinedrangexyplot , true ) ; ChartFrame frame = new ChartFrame ( "Semivariogram" , chart ) ; frame . pack ( ) ; frame . setVisible ( true ) ; }
it gets the semivariogram type and bins list and draw a graph for them theoryvariogram should be called first
