-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExample2.java
53 lines (40 loc) · 1.53 KB
/
Example2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package applications.statistics;
import plotting.PlotLine;
import plotting.PlotOptions;
import plotting.PlotScatter;
import tech.tablesaw.api.DoubleColumn;
import tech.tablesaw.api.Table;
import tech.tablesaw.plotly.Plot;
import tech.tablesaw.plotly.components.Figure;
import utils.TableDataSetLoader;
import java.io.File;
import java.io.IOException;
/** Category: Statistics
* ID: Example2
* Description: Scatter plot
* Taken From:
* Details:
* TODO
*/
public class Example2 {
public static void main(String[] args) throws IOException {
// load the data
Table dataSet = TableDataSetLoader.loadDataSet(new File("src/main/resources/datasets/iris_data.csv"));
DoubleColumn sepalLength = dataSet.doubleColumn("sepal_length");
sepalLength.setName("Sepal Length (cm)");
DoubleColumn sepalWidth = dataSet.doubleColumn("sepal_width");
sepalWidth.setName("Sepal Width (cm)");
PlotOptions options = new PlotOptions();
options.plotTitle = "Sepal Length vs Width";
Figure scatter = PlotScatter.buildPlot(options, sepalLength, sepalWidth);
DoubleColumn x = dataSet.doubleColumn("petal_length");
x.setName("Petal Length (cm)");
DoubleColumn y = dataSet.doubleColumn("petal_width");
y.setName("Petal Width (cm)");
PlotOptions petalOptions = new PlotOptions();
petalOptions.plotTitle = "Petal Length vs Width";
Figure line = PlotLine.buildPlot(petalOptions, x, y);
Plot.show(scatter);
Plot.show(line);
}
}