Search in sources :

Example 1 with Layout

use of tech.tablesaw.plotly.components.Layout 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 Layout

use of tech.tablesaw.plotly.components.Layout in project tablesaw by jtablesaw.

the class TimeSeriesPlot method create.

public static Figure create(String title, String xTitle, InstantColumn xCol, String yTitle, NumericColumn<?> yCol) {
    Layout layout = Layout.builder(title, xTitle, yTitle).build();
    ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
    return new Figure(layout, trace);
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Figure(tech.tablesaw.plotly.components.Figure)

Example 3 with Layout

use of tech.tablesaw.plotly.components.Layout in project tablesaw by jtablesaw.

the class TimeSeriesPlot method create.

public static Figure create(String title, String xTitle, DateTimeColumn xCol, String yTitle, NumericColumn<?> yCol) {
    Layout layout = Layout.builder(title, xTitle, yTitle).build();
    ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
    return new Figure(layout, trace);
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Figure(tech.tablesaw.plotly.components.Figure)

Example 4 with Layout

use of tech.tablesaw.plotly.components.Layout in project tablesaw by jtablesaw.

the class TimeSeriesPlot method createDateTimeSeries.

/**
 * Creates a time series where the x values are from a DateTimeColumn, rather than a DateColumn
 *
 * @param title The title of the plot
 * @param table The table containing the source data
 * @param dateTimeColumnName The name of a DateTimeColumn
 * @param numberColumnName The name of a NumberColumn
 * @return The figure to be displayed
 */
public static Figure createDateTimeSeries(String title, Table table, String dateTimeColumnName, String numberColumnName) {
    DateTimeColumn xCol = table.dateTimeColumn(dateTimeColumnName);
    NumericColumn<?> yCol = table.numberColumn(numberColumnName);
    Layout layout = Layout.builder(title, xCol.name(), yCol.name()).build();
    ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
    return new Figure(layout, trace);
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) DateTimeColumn(tech.tablesaw.api.DateTimeColumn) Figure(tech.tablesaw.plotly.components.Figure)

Example 5 with Layout

use of tech.tablesaw.plotly.components.Layout in project tablesaw by jtablesaw.

the class TimeSeriesPlot method create.

public static Figure create(String title, String xTitle, DateColumn xCol, String yTitle, NumericColumn<?> yCol) {
    Layout layout = Layout.builder(title, xTitle, yTitle).build();
    ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
    return new Figure(layout, trace);
}
Also used : Layout(tech.tablesaw.plotly.components.Layout) ScatterTrace(tech.tablesaw.plotly.traces.ScatterTrace) Figure(tech.tablesaw.plotly.components.Figure)

Aggregations

Layout (tech.tablesaw.plotly.components.Layout)75 Figure (tech.tablesaw.plotly.components.Figure)72 ScatterTrace (tech.tablesaw.plotly.traces.ScatterTrace)49 Table (tech.tablesaw.api.Table)30 Trace (tech.tablesaw.plotly.traces.Trace)19 IntColumn (tech.tablesaw.api.IntColumn)8 HistogramTrace (tech.tablesaw.plotly.traces.HistogramTrace)8 BarTrace (tech.tablesaw.plotly.traces.BarTrace)6 TableSliceGroup (tech.tablesaw.table.TableSliceGroup)6 Test (org.junit.jupiter.api.Test)5 Marker (tech.tablesaw.plotly.components.Marker)4 Axis (tech.tablesaw.plotly.components.Axis)3 Grid (tech.tablesaw.plotly.components.Grid)3 Scatter3DTrace (tech.tablesaw.plotly.traces.Scatter3DTrace)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 DateTimeColumn (tech.tablesaw.api.DateTimeColumn)2 Column (tech.tablesaw.columns.Column)2 BoxTrace (tech.tablesaw.plotly.traces.BoxTrace)2 PieTrace (tech.tablesaw.plotly.traces.PieTrace)2