examples.plotting.example4.example.md Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jstat Show documentation
Show all versions of jstat Show documentation
Java Library for Statistical Analysis.
The newest version!
# Example 4: Pie Plot
## Contents
* [Overview](#overview)
* [Import files](#include_files)
* [The main function](#m_func)
* [Results](#results)
* [Source Code](#source_code)
## Overview
## Import files
```
import dataloader.CsvDataLoader;
import tech.tablesaw.api.Table;
import visualizations.PieChart;
import java.io.File;
import java.io.IOException;
```
## The main function
```
public class Example4 {
public static void main(String[] args) throws IOException {
File file = new File("data/humans_data.csv");
Table table = CsvDataLoader.TableLoader.parseFile(file);
PieChart plotter = new PieChart();
PieChart.PieChartOptions options = plotter.new PieChartOptions();
options.chartTitle = "height by sex";
options.groupColName = "Sex";
options.numericColName = "Height";
PieChart.plotPie(options, table);
}
}
```
## Results
```
```
## Source Code
Example4.java