All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.tablesaw.api.plot.Quantile Maven / Gradle / Ivy

There is a newer version: 0.24.4
Show newest version
package tech.tablesaw.api.plot;

import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.plotting.xchart.XchartQuantile;

/**
 *
 */
public class Quantile {

    public static void show(String chartTitle, NumericColumn yColumn) {
        double[] x = new double[yColumn.size()];

        for (int i = 0; i < x.length; i++) {
            x[i] = i / (float) x.length;
        }

        NumericColumn copy = (NumericColumn) yColumn.copy();
        copy.sortAscending();
        show(chartTitle, x, copy);
    }

    public static void show(String chartTitle, double[] xData, NumericColumn yColumn) {

        // Create Chart
        XchartQuantile.show(chartTitle, xData, yColumn, 600, 400);
/*
    THIS CODE IS FOR A GLIMPSE-BACKED CHART
    double[] yData = yColumn.toDoubleArray();
    XchartScatter.SimpleScatter scatter = new XchartScatter.SimpleScatter(chartTitle, xData, yData);
    try {
      Display.showWithSwing(scatter);
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
*/
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy