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

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

The newest version!
# Example 3: Line 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.LineChart;

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

```

##  The main function

```
public class Example3 {

    public static void main(String[] args) throws IOException {


        File file = new File("data/annual.csv");
        Table table = CsvDataLoader.TableLoader.parseFile(file);

        // extract numeric samples from the data
        NumericSample X = CsvDataLoader.TableLoader.buildNumericSample(table, "Year");
        NumericSample Y = CsvDataLoader.TableLoader.buildNumericSample(table, "Mean");

        LineChart plotter = new LineChart();
        LineChart.LineChartOptions options = plotter.new LineChartOptions();
        options.chartTitle = "Per Year Mean";
        options.xAxisName = "Year";
        options.yAxisName = "Mean";
        LineChart.plotLine(X, Y, options);

    }

}

```

##  Results

```

```

##  Source Code

Example3.java




© 2015 - 2024 Weber Informatics LLC | Privacy Policy