Search in sources :

Example 11 with Figure

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

the class QuantilePlot method create.

/**
 * Returns a figure containing a Quantile Plot describing the distribution of values in the column
 * of interest
 *
 * @param title A title for the plot
 * @param table The table containing the column of interest
 * @param columnName The name of the numeric column containing the data to plot
 * @return A quantile plot
 */
public static Figure create(String title, Table table, String columnName) {
    NumericColumn<?> xCol = table.nCol(columnName);
    double[] x = new double[xCol.size()];
    for (int i = 0; i < x.length; i++) {
        x[i] = i / (float) x.length;
    }
    NumericColumn<?> copy = xCol.copy();
    copy.sortAscending();
    ScatterTrace trace = ScatterTrace.builder(x, copy.asDoubleArray()).build();
    Layout layout = Layout.builder().title(title).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 12 with Figure

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

the class AreaPlot method create.

public static Figure create(String title, Table table, String xCol, String yCol) {
    Layout layout = Layout.builder(title, xCol, yCol).build();
    ScatterTrace trace = ScatterTrace.builder(table.numberColumn(xCol), table.numberColumn(yCol)).mode(ScatterTrace.Mode.LINE).fill(ScatterTrace.Fill.TO_NEXT_Y).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 13 with Figure

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

the class LineOptionsExample method showDefaultLines.

private void showDefaultLines() {
    Layout layout = Layout.builder().title("Default Line Style").build();
    ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).build();
    Plot.show(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 14 with Figure

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

the class LineOptionsExample method showRedLines.

private void showRedLines() {
    Layout layout = Layout.builder().title("Red Lines").build();
    ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).line(Line.builder().color("red").build()).build();
    Plot.show(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 15 with Figure

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

the class LineOptionsExample method showWideLines.

/**
 * Sets the line width
 */
private void showWideLines() {
    Layout layout = Layout.builder().title("Wide lines").build();
    ScatterTrace trace = ScatterTrace.builder(x, y).mode(ScatterTrace.Mode.LINE).line(Line.builder().width(4).build()).build();
    Plot.show(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

Figure (tech.tablesaw.plotly.components.Figure)92 Layout (tech.tablesaw.plotly.components.Layout)72 ScatterTrace (tech.tablesaw.plotly.traces.ScatterTrace)53 Table (tech.tablesaw.api.Table)35 Test (org.junit.jupiter.api.Test)20 Trace (tech.tablesaw.plotly.traces.Trace)20 BarTrace (tech.tablesaw.plotly.traces.BarTrace)9 HistogramTrace (tech.tablesaw.plotly.traces.HistogramTrace)8 IntColumn (tech.tablesaw.api.IntColumn)7 File (java.io.File)6 TableSliceGroup (tech.tablesaw.table.TableSliceGroup)6 Marker (tech.tablesaw.plotly.components.Marker)4 Scatter3DTrace (tech.tablesaw.plotly.traces.Scatter3DTrace)4 ArrayList (java.util.ArrayList)3 Page (tech.tablesaw.plotly.components.Page)3 BoxTrace (tech.tablesaw.plotly.traces.BoxTrace)3 PieTrace (tech.tablesaw.plotly.traces.PieTrace)3 ViolinTrace (tech.tablesaw.plotly.traces.ViolinTrace)3 StringColumn (tech.tablesaw.api.StringColumn)2 Column (tech.tablesaw.columns.Column)2