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

examples.plotting.example2.example.md Maven / Gradle / Ivy

The newest version!
# Example 2: Histogram 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 datastructs.NumericSample;
import tech.tablesaw.api.Table;
import visualizations.Histograms;

import java.io.File;
import java.io.IOException;

```

##  The main function

```
public class Example2 {

    public static void main(String[] args) throws IOException {
        File file = new File("test_data/annual.csv");
        Table data = CsvDataLoader.TableLoader.parseFile(file);

        // Extract numeric samples from the data
        NumericSample X = CsvDataLoader.TableLoader.buildNumericSample(data, "Mean");

        Histograms plotter = new Histograms();
        Histograms.HistogramOptions options = plotter.new HistogramOptions();
        options.chartTitle = "distribution of mean temperature";
        options.xAxisName = "Mean";

        Histograms.plotHistogram(options, data);
    }
}

```

##  Results

```

```

##  Source Code

Example2.java




© 2015 - 2024 Weber Informatics LLC | Privacy Policy