tech.tablesaw.plotly.traces.BoxTrace Java Examples

The following examples show how to use tech.tablesaw.plotly.traces.BoxTrace. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BoxPlot.java    From jMetal with MIT License 6 votes vote down vote up
public static void main(String[] args) {
  Object[] x = {
    "sheep",
    "cows",
    "fish",
    "tree sloths",
    "sheep",
    "cows",
    "fish",
    "tree sloths",
    "sheep",
    "cows",
    "fish",
    "tree sloths"
  };
  double[] y = {1, 4, 9, 16, 3, 6, 8, 8, 2, 4, 7, 11};

  BoxTrace trace = BoxTrace.builder(x, y).build();
  Plot.show(new Figure(trace));
}
 
Example #2
Source File: BoxPlot.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
public static Figure create(
    String title, Table table, String groupingColumn, String numericColumn) {
  Layout layout = Layout.builder().title(title).height(HEIGHT).width(WIDTH).build();

  BoxTrace trace =
      BoxTrace.builder(table.categoricalColumn(groupingColumn), table.nCol(numericColumn))
          .build();
  return new Figure(layout, trace);
}
 
Example #3
Source File: BoxExample.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  Table table = Table.read().csv("../data/tornadoes_1950-2014.csv");

  Layout layout = Layout.builder().title("Tornado Injuries by Scale").build();

  BoxTrace trace =
      BoxTrace.builder(table.categoricalColumn("scale"), table.nCol("injuries")).build();
  Plot.show(new Figure(layout, trace));
}
 
Example #4
Source File: BoxTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
void show() {
  BoxTrace trace = BoxTrace.builder(x, y).build();
  Figure figure = new Figure(trace);
  assertNotNull(figure);
  Plot.show(figure, "target");
}
 
Example #5
Source File: BoxPlot.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
public static Figure create(
    String title, Table table, String groupingColumn, String numericColumn) {
  Layout layout = Layout.builder().title(title).height(HEIGHT).width(WIDTH).build();

  BoxTrace trace =
      BoxTrace.builder(table.categoricalColumn(groupingColumn), table.nCol(numericColumn))
          .build();
  return new Figure(layout, trace);
}
 
Example #6
Source File: BoxExample.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  Table table = Table.read().csv("../data/tornadoes_1950-2014.csv");

  Layout layout = Layout.builder().title("Tornado Injuries by Scale").build();

  BoxTrace trace =
      BoxTrace.builder(table.categoricalColumn("scale"), table.nCol("injuries")).build();
  Plot.show(new Figure(layout, trace));
}
 
Example #7
Source File: BoxTest.java    From tablesaw with Apache License 2.0 5 votes vote down vote up
@Test
void show() {
  BoxTrace trace = BoxTrace.builder(x, y).build();
  Figure figure = new Figure(trace);
  assertNotNull(figure);
  Plot.show(figure, "target");
}
 
Example #8
Source File: BoxTest.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
@Test
void testAsJavascript() {
  BoxTrace trace = BoxTrace.builder(x, y).build();
  assertNotNull(trace.asJavascript(1));
}
 
Example #9
Source File: BoxTest.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
/** Test ensures that the name() method returns a BoxTraceBuilder as expected. */
@Test
void name() {
  BoxTrace trace = BoxTrace.builder(x, y).name("my name").build();
  assertNotNull(trace);
}
 
Example #10
Source File: BoxTest.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
@Test
void testAsJavascript() {
  BoxTrace trace = BoxTrace.builder(x, y).build();
  assertNotNull(trace.asJavascript(1));
}
 
Example #11
Source File: BoxTest.java    From tablesaw with Apache License 2.0 4 votes vote down vote up
/** Test ensures that the name() method returns a BoxTraceBuilder as expected. */
@Test
void name() {
  BoxTrace trace = BoxTrace.builder(x, y).name("my name").build();
  assertNotNull(trace);
}