Search in sources :

Example 1 with Scatter3DTrace

use of tech.tablesaw.plotly.traces.Scatter3DTrace in project tablesaw by jtablesaw.

the class Scatter3DPlot method create.

public static Figure create(String title, Table table, String xCol, String yCol, String zCol, String sizeColumn, String groupCol) {
    TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
    Layout layout = standardLayout(title, xCol, yCol, zCol, false);
    Scatter3DTrace[] traces = new Scatter3DTrace[tables.size()];
    for (int i = 0; i < tables.size(); i++) {
        List<Table> tableList = tables.asTableList();
        Marker marker = Marker.builder().size(tableList.get(i).numberColumn(sizeColumn)).build();
        traces[i] = Scatter3DTrace.builder(tableList.get(i).numberColumn(xCol), tableList.get(i).numberColumn(yCol), tableList.get(i).numberColumn(zCol)).marker(marker).showLegend(true).name(tableList.get(i).name()).build();
    }
    return new Figure(layout, traces);
}
Also used : Table(tech.tablesaw.api.Table) Layout(tech.tablesaw.plotly.components.Layout) Scatter3DTrace(tech.tablesaw.plotly.traces.Scatter3DTrace) Marker(tech.tablesaw.plotly.components.Marker) TableSliceGroup(tech.tablesaw.table.TableSliceGroup) Figure(tech.tablesaw.plotly.components.Figure)

Example 2 with Scatter3DTrace

use of tech.tablesaw.plotly.traces.Scatter3DTrace in project tablesaw by jtablesaw.

the class Scatter3DTest method showText.

@Test
public void showText() {
    Scatter3DTrace trace = Scatter3DTrace.builder(x, y, z).mode(Scatter3DTrace.Mode.TEXT).text(labels).build();
    Plot.show(new Figure(trace));
}
Also used : Scatter3DTrace(tech.tablesaw.plotly.traces.Scatter3DTrace) Figure(tech.tablesaw.plotly.components.Figure) Test(org.junit.jupiter.api.Test)

Example 3 with Scatter3DTrace

use of tech.tablesaw.plotly.traces.Scatter3DTrace in project tablesaw by jtablesaw.

the class Scatter3DTest method testAsJavascript.

@Test
public void testAsJavascript() {
    Scatter3DTrace trace = Scatter3DTrace.builder(x, y, z).text(labels).build();
    assertNotNull(trace.asJavascript(1));
}
Also used : Scatter3DTrace(tech.tablesaw.plotly.traces.Scatter3DTrace) Test(org.junit.jupiter.api.Test)

Example 4 with Scatter3DTrace

use of tech.tablesaw.plotly.traces.Scatter3DTrace in project tablesaw by jtablesaw.

the class Scatter3DTest method showScatter.

@Test
public void showScatter() {
    Scatter3DTrace trace = Scatter3DTrace.builder(x, y, z).mode(Scatter3DTrace.Mode.MARKERS).text(labels).build();
    Layout layout = Layout.builder().xAxis(Axis.builder().title("x title").build()).build();
    assertEquals("x title", layout.getTitle());
    Plot.show(new Figure(layout, trace));
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) Scatter3DTrace(tech.tablesaw.plotly.traces.Scatter3DTrace) Figure(tech.tablesaw.plotly.components.Figure) Test(org.junit.jupiter.api.Test)

Example 5 with Scatter3DTrace

use of tech.tablesaw.plotly.traces.Scatter3DTrace in project tablesaw by jtablesaw.

the class Scatter3DTest method showLineAndMarkers.

@Test
public void showLineAndMarkers() {
    Scatter3DTrace trace = Scatter3DTrace.builder(x, y, z).mode(Scatter3DTrace.Mode.LINE_AND_MARKERS).build();
    Layout layout = Layout.builder().xAxis(Axis.builder().title("x title").build()).build();
    Plot.show(new Figure(layout, trace));
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) Scatter3DTrace(tech.tablesaw.plotly.traces.Scatter3DTrace) Figure(tech.tablesaw.plotly.components.Figure) Test(org.junit.jupiter.api.Test)

Aggregations

Scatter3DTrace (tech.tablesaw.plotly.traces.Scatter3DTrace)5 Test (org.junit.jupiter.api.Test)4 Figure (tech.tablesaw.plotly.components.Figure)4 Layout (tech.tablesaw.plotly.components.Layout)3 Table (tech.tablesaw.api.Table)1 Marker (tech.tablesaw.plotly.components.Marker)1 TableSliceGroup (tech.tablesaw.table.TableSliceGroup)1